Автор работы: Пользователь скрыл имя, 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
Label13: TLabel;
ButtonPrint: TButton;
ButtonCalculate: TButton;
Panel2: TPanel;
DBNavigator1: TDBNavigator;
ButtonRefreshTariffs: TButton;
Panel3: TPanel;
DBNavigator2: TDBNavigator;
ButtonRefreshInvestors: TButton;
GroupBox3: TGroupBox;
StringGridCalc: TStringGrid;
Panel4: TPanel;
DBNavigator3: TDBNavigator;
ButtonRefreshAccounts: TButton;
ButtonAdd: TButton;
ADOQueryADD: TADOQuery;
procedure FormCreate(Sender: TObject);
procedure ButtonRefreshTariffsClick(
procedure ButtonRefreshInvestorsClick(
procedure ButtonRefreshAccountsClick(
procedure ButtonCalculateClick(Sender: TObject);
procedure ComboBox1Select(Sender: TObject);
procedure DateTimePicker1Change(Sender: TObject);
procedure SpinEdit2Change(Sender: TObject);
procedure DateTimePicker2Change(Sender: TObject);
procedure GroupBox1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure GroupBox1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure SpinEdit1Change(Sender: TObject);
procedure FloatSpinEdit1EdtChange(
procedure ComboBox2Change(Sender: TObject);
procedure FloatSpinEdit2EdtChange(
procedure FloatSpinEdit3EdtChange(
procedure StringGridDepDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure ButtonPrintClick(Sender: TObject);
procedure CheckBoxCyrrencyClick(Sender: TObject);
procedure CheckBoxTariffClick(Sender: TObject);
procedure StringGridDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure RadioGroupCalculateClick(
procedure ButtonAddClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TAccounts=record
Viplat : array[1..999] of Integer;
AccountID : integer;
Summa : real;
Balance :real;
Length : integer;
end;
var
MainForm: TMainForm;
CONECT_STR :String;
IDChet,FIO,Passport,INN,Reg, DateR,Inf,Val:string;
implementation
uses UReport, UnitRepDep;
{$R *.dfm}
procedure TMainForm.
begin
ADOQTariffs.Active :=false;
ADOQTariffs.Active :=true;
end;
procedure TMainForm.
begin
ADOQInvestors.Active :=false;
ADOQInvestors.Active :=true;
end;
procedure TMainForm.
begin
ADOQAccounts.Active :=false;
ADOQAccounts.Active :=true;
end;
procedure TMainForm.
var
str,timeBegin,timeEnd,
time1,time2: TDateTime;
i,countM:integer;
n:integer;
Balance,Summa,Rate, BalanceRef,RateRef,sum,Summa1:
Year, Month, Day :Word;
st0,st1:char;
begin
For i:=0 to StringGrid.RowCount-1 do
StringGrid.Rows[i].Clear;
if RadioGroupCalculate.ItemIndex = 0 then
begin
if CheckBoxCyrrency.Checked = true then
begin
if DBLookupComboBoxCyrrency.Text = ''
then
cyrrency:= '1'
else
cyrrency := DBLookupComboBoxCyrrency.
end;
StringGrid.Cells[0,0]:='№ Счёта';
StringGrid.Cells[1,0]:='Дата открытия'#13'счёта';
StringGrid.Cells[2,0]:='Дата закрытия'#13'счёта';
StringGrid.Cells[3,0]:='Началь
StringGrid.Cells[4,0]:='Процен
StringGrid.Cells[5,0]:='Начисл
StringGrid.Cells[6,0]:='Конечн
StringGrid.Cells[7,0]:='Описан
timeEnd := DateTimeToStr(
for i:=0 to length(timeEnd) do
if timeEnd[i] = '.' then timeEnd[i]:='-';
st0:=timeEnd[1];
st1:=timeEnd[2];
timeEnd[1]:=timeEnd[4];
timeEnd[2]:=timeEnd[5];
timeEnd[4]:=st0;
timeEnd[5]:=st1;
Delete(timeEnd, 11,10);
timeEnd := '#' + timeEnd + '#';
ADOQTime.SQL.Clear;
if CheckBoxTime.Checked = true then
begin
if CheckBoxCyrrency.Checked = true
then
str := 'SELECT AccountID,DataBegin,DataEnd,
' FROM Accounts inner join Tariffs on Accounts.TariffName=Tariffs.
else
begin
if CheckBoxTariff.Checked = true then
str := 'SELECT AccountID,DataBegin,DataEnd,
' FROM Accounts inner join Tariffs on Accounts.TariffName=Tariffs.
else
str := 'SELECT AccountID,DataBegin,DataEnd,
' FROM Accounts inner join Tariffs on Accounts.TariffName=Tariffs.
end
end
else
begin
if CheckBoxCyrrency.Checked = true
then
str := 'SELECT AccountID,DataBegin,DataEnd,
' FROM Accounts inner join Tariffs on Accounts.TariffName=Tariffs.
else
if CheckBoxTariff.Checked = true then
str := 'SELECT AccountID,DataBegin,DataEnd,
' FROM Accounts inner join Tariffs on Accounts.TariffName=Tariffs.
else
str := 'SELECT AccountID,DataBegin,DataEnd,
' FROM Accounts inner join Tariffs on Accounts.TariffName=Tariffs.
end ;
ADOQTime.SQL.Add(str);
ADOQTime.ExecSQL;
ADOQTime.close;
ADOQTime.open;
if ADOQTime.RecordCount>=1 then
StringGrid.RowCount:=ADOQTime.
else
StringGrid.RowCount :=2;
ADOTableNumDeposit.Active :=true;
n:=0;
ADOQTime.First;
while not ADOQTime.Eof do
begin
Val := ' руб.';
if ADOQTime.FieldByName('
then Val := ' $';
if ADOQTime.FieldByName('
then Val := ' €';
n:=n+1;
StringGrid.Cells[0,n]:=
StringGrid.Cells[1,n]:=
StringGrid.Cells[2,n]:=
StringGrid.Cells[3,n]:=
StringGrid.Cells[4,n]:=
StringGrid.Cells[5,n]:=
RateRef:=13;
if (ADOQTime.FieldByName('
then
RateRef:=9;
if (ADOQTime.FieldByName('
then
begin
countM:= ADOQTime.FieldByName('Length')
// time1:=ADOQTime.FieldByName('
// time2:=ADOQTime.FieldByName('
// countD:=daysBetween(time2,
//edit1.Text :=IntToStr (countD)
end
else
begin
time1:=ADOQTime.FieldByName('
time2:=DateTimePickerEnd.Date;
countM:= MonthsBetween(time1,time2);
//countD:=daysBetween(time1,
// edit1.Text :=IntToStr (countD);
//edit1.Text :=IntToStr (countM)
end ;
Summa :=ADOQTime.FieldByName('Summa'
Rate := ADOQTime.FieldByName('Rate').
if ADOQTime.FieldByName('
then
begin
// Balance := Summa *exp(Ln(1+(Rate*(365/12))/
if Rate>Rateref then
Balance := Summa *exp(Ln(1+(Rate*(365/12))/
else
Balance := Summa *exp(Ln(1+(Rate*(365/12))/
{ balanceRef := Summa *exp(Ln(1+(RateRef*(365/12))/
If Balance-Summa> balanceRef then
begin
BalanceRef:= (Balance-Summa-balanceRef)*0.
Balance :=Balance -BalanceRef;
end }
end;
if ADOQTime.FieldByName('
begin
if countM<3 then
begin
Balance := Summa+Summa * ((Rate * countM*(365/12)) / (36500));
balanceRef := Summa * ((RateRef * countM*(365/12)) / (36500));
If Balance-Summa> balanceRef then
begin
BalanceRef:= (Balance-Summa-balanceRef)*0.
Balance :=Balance -BalanceRef;
end
end
else
begin
if Rate>RateRef then
Balance := Summa *exp(Ln(1+(Rate*3*(365/12))/
else
Balance := Summa *exp(Ln(1+(Rate*3*(365/12))/
Summa1:=Summa;
Summa:=Balance;
Balance := Summa+Summa*((Rate*(countM mod 3)*(365/12))/(36500));
balanceRef := Summa * ((RateRef * (countM mod 3)*(365/12)) / (36500));
If Balance-Summa> balanceRef then
begin
BalanceRef:= (Balance-Summa-balanceRef)*0.
Balance :=Balance -BalanceRef;
end;
Summa:=Summa1;
end
end ;
if ADOQTime.FieldByName('
if countM<12 then
begin
Balance := Summa+Summa * ((Rate * countM*(365/12)) / (36500));
balanceRef := Summa * ((RateRef * countM*(365/12)) / (36500));
If Balance-Summa> balanceRef then
begin
BalanceRef:= (Balance-Summa-balanceRef)*0.
Balance :=Balance -BalanceRef;
end
end
else
begin
if Rate>RateRef then
Balance := Summa *exp(Ln(1+(Rate)/100-0.35*((
else
Balance := Summa *exp(Ln(1+(Rate)/100)*(countM div 12));
Summa1:=Summa;
Summa:=Balance;
Balance := Balance+Balance*((Rate*(countM mod 12)*(365/12))/(36500));
balanceRef := Summa * ((RateRef * (countM mod 12)*(365/12)) / (36500));
If Balance-Summa> balanceRef then
begin
BalanceRef:= (Balance-Summa-balanceRef)*0.
Balance :=Balance -BalanceRef;
end;
Summa:=Summa1;
end
end;
if ADOQTime.FieldByName('
then
begin
Balance := Summa+Summa * ((Rate * countM*(365/12)) / (36500));
balanceRef := Summa * ((RateRef * countM*(365/12)) / (36500));
If Balance-Summa> balanceRef then
begin
BalanceRef:= (Balance-Summa-balanceRef)*0.
Balance :=Balance -BalanceRef;
end
end;
Balance:=round(Balance*100)/
StringGrid.Cells[6,n]:=
Summa:= Balance-Summa;
Summa:= round((Summa)*100)/100;
StringGrid.Cells[7,n]:='Начисл
//x^y - это exp(y*ln(x))
ADOQTime.Next
end;
end;
if RadioGroupCalculate.ItemIndex = 1 then
begin
accountID := DBLookupComboBoxNumDeposit.
ADOQTime.SQL.Clear;
str := 'SELECT AccountID,DataBegin,DataEnd,
' FROM Accounts inner join Tariffs on Accounts.TariffName=Tariffs.
ADOQTime.SQL.Add(str);
//edit1.Text := str;
ADOQTime.ExecSQL;
ADOQTime.close;
ADOQTime.open;
Val := ' руб.';
if ADOQTime.FieldByName('
then Val := ' $';
if ADOQTime.FieldByName('
then Val := ' €';
Rate := ADOQTime.FieldByName('Rate').
Summa :=ADOQTime.FieldByName('Summa'
countM:= ADOQTime.FieldByName('Length')
time1:=ADOQTime.FieldByName('
periodicity := ADOQTime.FieldByName('
RateRef:=13;
if (ADOQTime.FieldByName('
then
RateRef:=9;
StringGrid.RowCount := countM+2;
StringGrid.Cells[0,0]:='№';
StringGrid.Cells[1,0]:='Дата';
StringGrid.Cells[2,0]:='
StringGrid.Cells[3,0]:='
StringGrid.Cells[4,0]:='
StringGrid.Cells[5,0]:='Сумма'
StringGrid.Cells[6,0]:='
StringGrid.Cells[7,0]:='Сумма'
For n:=1 to countM do
begin
BalanceRef:=0;
StringGrid.Cells[0,n]:=
StringGrid.Cells[2,n]:=
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)/
BalanceRef:=round(BalanceRef*
BalanceRef :=Balance-BalanceRef;
BalanceRef:=round(BalanceRef*
If BalanceRef>0 then
begin
StringGrid.Cells[4,n]:=
BalanceRef := BalanceRef*35/100;
BalanceRef:=round(BalanceRef*
StringGrid.Cells[5,n]:=
end
else
begin
StringGrid.Cells[4,n]:='0';
StringGrid.Cells[5,n]:='0';
end;
StringGrid.Cells[3,n]:=
if BalanceRef>0 then
Balance:=Balance-BalanceRef;
Balance:=round(Balance*100)/
StringGrid.Cells[6,n]:=
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)));
StringGrid.Cells[3,n]:=
BalanceRef:=round(BalanceRef*
if BalanceRef>0 then
StringGrid.Cells[4,n]:=
else
StringGrid.Cells[4,n]:='0';
if BalanceRef>0 then
BalanceRef := BalanceRef*35/100
else
BalanceRef :=0;
BalanceRef:=round(BalanceRef*
StringGrid.Cells[5,n]:=
StringGrid.Cells[6,n]:=
Summa := Summa+Summa*((Rate*(countM mod 3)*(365/12))/(36500))- BalanceRef;
Информация о работе Разработка программного модуля начисления процентов