Сурет Есеп шығару алгоритмінің бейнеленуі. 8 Іі-бөлім «несиелерді рәсімдеу» абж қҰру 9


uCr_stat формасының прогаммалық коды



бет10/11
Дата01.04.2024
өлшемі0.92 Mb.
#497131
1   2   3   4   5   6   7   8   9   10   11
диплом

uCr_stat формасының прогаммалық коды
unit uCr_stat;

var
frmCred_stat: TfrmCred_stat;

implementation


uses uDMCredits;
{$R *.dfm}

procedure TfrmCred_stat.btnCloseClick(Sender: TObject);


begin
if radiogrZStat.ItemIndex=0 then
begin
if radiogrZOn.ItemIndex>-1 then
begin
if dmCreditsMain.tblCr_status.Locate('crs_name', radiogrZOn.Items[radiogrZOn.ItemIndex], [loCaseInsensitive]) then
begin
ifnotdmCreditsMain.tblCr_history.Locate('crh_status', dmCreditsMain.tblCr_status.FieldByName('crs_id').AsInteger, [loCaseInsensitive]) then
begin
dmCreditsMain.tblCr_history.Append;
dmCreditsMain.tblCr_history.FieldByName('cr_id').AsInteger:=dmCreditsMain.tblAcredits.FieldByName('cr_id').AsInteger;
dmCreditsMain.tblCr_history.FieldByName('crh_status').AsInteger:=dmCreditsMain.tblCr_status.FieldByName('crs_id').AsInteger;
dmCreditsMain.tblCr_history.FieldByName('crh_date').AsDateTime:=datetimeStatsel.DateTime;
dmCreditsMain.tblCr_history.Post;
end;
dmCreditsMain.tblAcredits.Edit;
dmCreditsMain.tblAcredits.FieldByName('cr_crstat').AsInteger:=dmCreditsMain.tblCr_status.FieldByName('crs_id').AsInteger;
dmCreditsMain.tblAcredits.FieldByName('cr_active').AsBoolean:=true;
if dmCreditsMain.tblCr_status.FieldByName('crs_bm').AsBoolean then
dmCreditsMain.tblAcredits.FieldByName('cr_pay').AsBoolean:=true;
if dmCreditsMain.tblCr_status.FieldByName('crs_end').AsBoolean then
dmCreditsMain.tblAcredits.FieldByName('cr_pay').AsBoolean:=true;
dmCreditsMain.tblAcredits.Post;
end;
Close;
end
else
MessageDlg('Мәлімдеменің статусын көрсетіңіз!', mtWarning, [mbOk],0);
end
else
begin
if radiogrZOff.ItemIndex>-1 then
begin
if dmCreditsMain.tblCr_status.Locate('crs_name', radiogrZOff.Items[radiogrZOff.ItemIndex], [loCaseInsensitive]) then
begin
if not dmCreditsMain.tblCr_history.Locate('crh_status', dmCreditsMain.tblCr_status.FieldByName('crs_id').AsInteger, [loCaseInsensitive]) then
begin
dmCreditsMain.tblCr_history.Append;
dmCreditsMain.tblCr_history.FieldByName('cr_id').AsInteger:=dmCreditsMain.tblAcredits.FieldByName('cr_id').AsInteger;
dmCreditsMain.tblCr_history.FieldByName('crh_status').AsInteger:=dmCreditsMain.tblCr_status.FieldByName('crs_id').AsInteger;
dmCreditsMain.tblCr_history.FieldByName('crh_date').AsDateTime:=datetimeStatsel.DateTime;
dmCreditsMain.tblCr_history.Post;
end;
dmCreditsMain.tblAcredits.Edit;
dmCreditsMain.tblAcredits.FieldByName('cr_crstat').AsInteger:=dmCreditsMain.tblCr_status.FieldByName('crs_id').AsInteger;
dmCreditsMain.tblAcredits.FieldByName('cr_active').AsBoolean:=false;
dmCreditsMain.tblAcredits.Post;
end;
Close;
end
else
MessageDlg('Мәлімдеменің статусын косетіңіз!', mtWarning, [mbOk],0);
end;
end;

procedure TfrmCred_stat.radiogrZStatClick(Sender: TObject);


begin
if radiogrZStat.ItemIndex=0 then
begin
radiogrZOn.Enabled:=true;
radiogrZOff.Enabled:=false;
end
else
begin
radiogrZOn.Enabled:=false;
radiogrZOff.Enabled:=true;
end;
end;

procedure TfrmCred_stat.FormCreate(Sender: TObject);


var
iStat:integer;
sStatName:string;
begin
with dmCreditsMain do
begin
iStat:=tblAcredits.FieldByName('cr_crstat').AsInteger;
tblCr_status.First;
While not tblCr_status.Eof do
begin
if tblCr_status.FieldByName('crs_good').AsBoolean then
radiogrZOn.Items.Add(tblCr_status.FieldByName('crs_name').AsString)
else
radiogrZOff.Items.Add(tblCr_status.FieldByName('crs_name').AsString);
tblCr_status.Next;
end;
if tblCr_status.Locate('crs_id', iStat, [loCaseInsensitive]) then
begin
sStatName:=tblCr_status.FieldByName('crs_name').AsString;
if tblCr_status.FieldByName('crs_good').AsBoolean then
begin
radiogrZStat.ItemIndex:=0;
radiogrZOn.ItemIndex:=radiogrZOn.Items.IndexOf(sStatName);
end
else
begin
radiogrZStat.ItemIndex:=1;
radiogrZOff.ItemIndex:=radiogrZOn.Items.IndexOf(sStatName);
end;
radiogrZStatClick(sender);
end;
end;

end;
end.




Достарыңызбен бөлісу:
1   2   3   4   5   6   7   8   9   10   11




©dereksiz.org 2024
әкімшілігінің қараңыз

    Басты бет