Ўзбекистон республикаси олий ва ўрта махсус таълим вазирлиги наманган муҳандислик-педагогика институти
www.uz – миллий ахборот қидирув тизими mail.uz
Download 1.52 Mb.
|
NamMPI BMI 81
www.uz – миллий ахборот қидирув тизими
mail.uz – миллий электрон почта хизмати ziyonet.uz – ахборот таълим тармоғи uforum.uz – муҳокама веб портали edu.uz – Ўзбекистон таълим портали aci.uz - Ўзбекистон алоқа ва ахборотлаштириш агентлиги портали google.uz – миллий ахборот қидирув тизими www.citforum.ru. http://eyecenter.com.ua http://if.isra.co.il. http://www-psb.ad-sbras.nsc.ru/kruglw.htm http://gazeta.msk.ru/dossier/19-05-1999_torsion_Printed.htm http://aurum.freeservers.com/cgi-bin/framed/2663/torsion.htm Илова. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Menus, DB, DBTables, StdCtrls, ExtCtrls, Grids, DBGrids, Buttons, ComObj, ComCtrls; type TForm1 = class(TForm) MainMenu1: TMainMenu; Fayl1: TMenuItem; axrirlash1: TMenuItem; GuruhTalaba1: TMenuItem; DSGuruh: TDataSource; DSTalaba: TDataSource; DSTulov: TDataSource; Guruh: TTable; Talaba: TTable; Tulov: TTable; ulov1: TMenuItem; Yangi1: TMenuItem; axrirlash2: TMenuItem; Panel1: TPanel; KursCB: TComboBox; Label1: TLabel; DBGrid1: TDBGrid; DBGrid2: TDBGrid; DBGrid3: TDBGrid; Splitter1: TSplitter; BitBtn1: TBitBtn; StatusBar1: TStatusBar; import1: TMenuItem; Memo1: TMemo; BitBtn2: TBitBtn; procedure GuruhTalaba1Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure GuruhAfterScroll(DataSet: TDataSet); procedure KursCBChange(Sender: TObject); procedure TalabaAfterScroll(DataSet: TDataSet); procedure Yangi1Click(Sender: TObject); procedure axrirlash2Click(Sender: TObject); procedure BitBtn1Click(Sender: TObject); procedure BitBtn2Click(Sender: TObject); private { Private declarations } public { Public declarations } Path: String; end; var Form1: TForm1; implementation uses Unit2, Unit5; procedure TForm1.GuruhTalaba1Click(Sender: TObject); begin guruh.Filter:='kurs='+form2.KursCB.Text; if guruh['ID']<>Null then talaba.Filter:='ID_Guruh='+IntToStr(guruh['ID']); Form2.ShowModal; end; procedure TForm1.FormCreate(Sender: TObject); var i:Integer; begin Path := ParamStr(0); i:= Length(Path); while Path[i]<> '\' do i:=i-1; Path := Copy(Path, 1, i-1); Tulov.DatabaseName := Path+'\Base'; Tulov.TableName := 'Tulov.db' ; Tulov.Open; Talaba.DatabaseName := Path+'\Base'; Talaba.TableName := 'Talaba.db' ; Talaba.Open; Guruh.DatabaseName := Path+'\Base'; Guruh.TableName := 'Guruh.db' ; Guruh.Open; guruh.Filter:='kurs='+KursCB.Text; if guruh['ID']<>Null then talaba.Filter:='ID_Guruh='+IntToStr(guruh['ID']); if talaba['ID']<>Null then tulov.Filter:='ID_Talaba='+IntToStr(Talaba['ID']) else tulov.Filter:='ID_Talaba<0'; end; procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin if guruh.Modified then guruh.Post; guruh.Close; if Talaba.Modified then Talaba.Post; Talaba.Close; if Tulov.Modified then Tulov.Post; Tulov.Close; end; procedure TForm1.GuruhAfterScroll(DataSet: TDataSet); begin if guruh['ID']<>Null then talaba.Filter:='ID_Guruh='+IntToStr(guruh['ID']) else talaba.Filter:='ID<0'; end; procedure TForm1.KursCBChange(Sender: TObject); begin If KursCB.ItemIndex<0 then begin showmessage('Kursni to`g`ri tanlang!!!'); exit; end; guruh.Filter:='kurs='+KursCB.Text; if guruh['ID']<>Null then talaba.Filter:='ID_Guruh='+IntToStr(guruh['ID']); end; procedure TForm1.TalabaAfterScroll(DataSet: TDataSet); var Summa :Integer; begin if talaba['ID']<>Null then begin tulov.Filter:='ID_Talaba='+IntToStr(Talaba['ID']); Tulov.First; Summa :=0; While Not form1.Tulov.eof Do Begin Summa := Summa + form1.Tulov['Tulov']; form1.Tulov.Next; end; StatusBar1.Panels[0].Text :='Tulov: '+ IntToStr(Summa)+' sum'; end else tulov.Filter:='ID_Talaba<0'; end; procedure TForm1.Yangi1Click(Sender: TObject); begin form5.Tag:=0; form5.p_nomED.Text:=''; form5.P_sanaED.Date:=date; form5.K_sanaED.Date:=date; form5.summaED.Value:=0; form5.ShowModal; end; procedure TForm1.axrirlash2Click(Sender: TObject); begin form5.Tag:=1; form5.p_nomED.Text:=form1.Tulov['p_nom']; form5.P_sanaED.Date:=form1.Tulov['p_sana']; form5.K_sanaED.Date:=form1.Tulov['k_sana']; form5.summaED.Value:=form1.Tulov['summa']; form5.ShowModal; end; Procedure SendtoExcel({ShFile: String;} Querys: TTable); Var ExcelApp, Workbook, Range, Cell1, Cell2, ArrayData: Variant; BeginCol, BeginRow, j,i,Summa: integer; RowCount, ColCount: Integer; Begin BeginCol := 1; BeginRow := 3; // Размеры выводимого массива данных RowCount := Querys.RecordCount; ColCount := Querys.FieldDefs.Count; // Создание Excel ExcelApp := CreateOleObject('Excel.Application'); // Отключаем реакцию Excel на события, чтобы ускорить вывод информации ExcelApp.Application.EnableEvents := false; // Создаем Книгу (Workbook) // Если заполняем шаблон, то Workbook := ExcelApp.WorkBooks.Add(null); ArrayData := VarArrayCreate([1, RowCount, 1, ColCount+1], varVariant); // Заполняем массив Querys.DisableControls; form1.Tulov.DisableControls; Querys.First; i:=0; While Not Querys.eof Do Begin i:=i+1; For J := 1 To Querys.FieldDefs.Count Do Begin ArrayData[i, J] := Querys.FieldbyName(Querys.FieldDefs.Items[j - 1].DisplayName).value; End; form1.Tulov.Filter := 'ID_talaba='+IntToStr(form1.Talaba['ID']); form1.Tulov.First; Summa :=0; While Not form1.Tulov.eof Do Begin Summa := Summa + form1.Tulov['Tulov']; form1.Tulov.Next; end; ArrayData[i, J] := Summa; Querys.Next; End; Querys.EnableControls; form1.Tulov.EnableControls; // Левая верхняя ячейка области, в которую будем выводить данные Cell1 := WorkBook.WorkSheets[1].Cells[BeginRow, BeginCol]; // Правая нижняя ячейка области, в которую будем выводить данные Cell2 := WorkBook.WorkSheets[1].Cells[BeginRow + RowCount - 1, BeginCol + ColCount ]; // Область, в которую будем выводить данные Range := WorkBook.WorkSheets[1].Range[Cell1, Cell2]; // А вот и сам вывод данных // Намного быстрее поячеечного присвоения Range.Value := ArrayData; // Делаем Excel видимым ExcelApp.Visible := True; End; procedure TForm1.BitBtn1Click(Sender: TObject); var s:String; begin // if not InputQuery('Fayl','',S) then exit; // if Trim(S)='' then exit; // SendtoExcel(Path+'\'+S+'.xls', Talaba); , // SendtoExcel('Лист1', Talaba); SendtoExcel(Talaba); end; procedure TForm1.BitBtn2Click(Sender: TObject); var i,kurs,IDG,IDT:integer; GNom,FIO: String; begin memo1.Lines.LoadFromFile(path+'\1.txt'); i:=0; guruh.Filtered := False; Talaba.Filtered := False; while i<=memo1.lines.count-1 do begin kurs:=strtoint(memo1.lines[i]); i:=i+1; GNom:=memo1.lines[i]; i:=i+1; FIO:=memo1.lines[i]; if not Guruh.Locate('Nom',GNOM,[]) then begin Guruh.Append; Guruh['Kurs'] := Kurs; Guruh['Nom'] := GNOM; Guruh['Rahbar'] := '_'; Guruh['R_Tel'] := '_'; Guruh['Sardor'] := '_'; Guruh['S_Tel'] := '_'; Guruh['Summa'] := 0; Guruh.Post; end; IDG := Guruh['ID']; if not Talaba.Locate('FIO',FIO,[]) then begin Talaba.Append; Talaba['Kurs'] := Kurs; Talaba['FIO'] := FIO; Talaba['ID_Guruh'] := IDG; Talaba['Stip1'] := 0; Talaba['Stip2'] := 0; Talaba.Post; end; i:=i+1; end; guruh.Filtered := True; Talaba.Filtered := True; end; end. unit Unit2; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls, Grids, DBGrids, Buttons, DBCtrls; type
GroupBox1: TGroupBox; DBGrid1: TDBGrid; Panel1: TPanel; GroupBox2: TGroupBox; DBGrid2: TDBGrid; Panel2: TPanel; Panel3: TPanel; KursCB: TComboBox; Label1: TLabel; Splitter1: TSplitter; YangiG: TBitBtn; TaxrirG: TBitBtn; UchirG: TBitBtn; YangiT: TBitBtn; TaxrirT: TBitBtn; UchirT: TBitBtn; procedure YangiGClick(Sender: TObject); procedure TaxrirGClick(Sender: TObject); procedure KursCBChange(Sender: TObject); procedure UchirGClick(Sender: TObject); procedure YangiTClick(Sender: TObject); procedure TaxrirTClick(Sender: TObject); procedure UchirTClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form2: TForm2; implementation uses Unit3, Unit1, Unit4; procedure TForm2.YangiGClick(Sender: TObject); begin form3.Tag :=0; with form1 do begin form2.KursCB.ItemIndex:=0; form3.guruhed.Text:=''; form3.rahbared.Text:=''; form3.r_teled.Text:=''; form3.sardored.Text:=''; form3.s_teled.Text:=''; form3.summaed.Value:=0; end; form3.ShowModal; end; procedure TForm2.TaxrirGClick(Sender: TObject); begin with form1 do begin form2.KursCB.ItemIndex:=guruh['kurs']-1; form3.guruhed.Text:=guruh['nom']; form3.rahbared.Text:=guruh['rahbar']; form3.r_teled.Text:=guruh['r_tel']; form3.sardored.Text:=guruh['sardor']; form3.s_teled.Text:=guruh['s_tel']; form3.summaed.Value:=guruh['summa']; end; form3.Tag :=1; form3.ShowModal; end; procedure TForm2.KursCBChange(Sender: TObject); begin If KursCB.ItemIndex<0 then begin showmessage('Kursni to`g`ri tanlang!!!'); exit; end; form1.guruh.Filter:='kurs='+form2.KursCB.Text; if form1.guruh['ID']<>Null then Form1.talaba.Filter:='ID_Guruh='+IntToStr(Form1.guruh['ID']); end; procedure TForm2.UchirGClick(Sender: TObject); begin with form1 do begin if Talaba.RecordCount >0 then begin showmessage('Guruhda talaba mavjud.'+#13+'O`chirish mumkin emas!!!'); exit; end; if MessageDlg('Tanlangan guruh o`chriladi. Ha/Yo`q?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin guruh.Delete; end; end; end; procedure TForm2.YangiTClick(Sender: TObject); begin form4.Tag :=0; with form1 do begin form2.KursCB.ItemIndex:=0; form4.Edit1.Text:=''; form4.Edit2.Text:='0'; form4.Edit3.Text:='0'; end; form4.ShowModal; end; procedure TForm2.TaxrirTClick(Sender: TObject); begin form4.Tag :=1; with form1 do begin form2.KursCB.ItemIndex:=talaba['kurs']-1; form4.Edit1.Text:=talaba['fio']; form4.Edit2.Text:=talaba['stip1']; form4.Edit3.Text:=talaba['stip2']; end; form4.ShowModal; end; procedure TForm2.UchirTClick(Sender: TObject); begin with form1 do begin if Talaba.RecordCount >0 then begin showmessage('Bu talabada tulov mavjud.'+#13+'O`chirish mumkin emas!!!'); exit; end; if MessageDlg('Tanlangan talaba o`chriladi. Ha/Yo`q?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin talaba.Delete; end; end; end; end. begin guruh.Filter:='kurs='+form2.KursCB.Text; if guruh['ID']<>Null then talaba.Filter:='ID_Guruh='+IntToStr(guruh['ID']); Form2.ShowModal; end; procedure TForm1.FormCreate(Sender: TObject); var i:Integer; begin Path := ParamStr(0); i:= Length(Path); while Path[i]<> '\' do i:=i-1; Path := Copy(Path, 1, i-1); Tulov.DatabaseName := Path+'\Base'; Tulov.TableName := 'Tulov.db' ; Tulov.Open; Talaba.DatabaseName := Path+'\Base'; Talaba.TableName := 'Talaba.db' ; Talaba.Open; Guruh.DatabaseName := Path+'\Base'; Guruh.TableName := 'Guruh.db' ; Guruh.Open; guruh.Filter:='kurs='+KursCB.Text; if guruh['ID']<>Null then talaba.Filter:='ID_Guruh='+IntToStr(guruh['ID']); if talaba['ID']<>Null then tulov.Filter:='ID_Talaba='+IntToStr(Talaba['ID']) else tulov.Filter:='ID_Talaba<0'; StatusBar1.Font.Size:=12; StatusBar1.Font.Style:=[FSBold]; end; procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin if guruh.Modified then guruh.Post; guruh.Close; if Talaba.Modified then Talaba.Post; Talaba.Close; if Tulov.Modified then Tulov.Post; Tulov.Close; end; procedure TForm1.GuruhAfterScroll(DataSet: TDataSet); begin if guruh['ID']<>Null then talaba.Filter:='ID_Guruh='+IntToStr(guruh['ID']) else talaba.Filter:='ID<0'; end; procedure TForm1.KursCBChange(Sender: TObject); begin If KursCB.ItemIndex<0 then begin showmessage('Kursni to`g`ri tanlang!!!'); exit; end; guruh.Filter:='kurs='+KursCB.Text; if guruh['ID']<>Null then talaba.Filter:='ID_Guruh='+IntToStr(guruh['ID']); end; procedure TForm1.TalabaAfterScroll(DataSet: TDataSet); var Summa :Integer; begin if talaba['ID']<>Null then begin tulov.Filter:='ID_Talaba='+IntToStr(Talaba['ID']); Tulov.First; Summa :=0; While Not form1.Tulov.eof Do Begin Summa := Summa + form1.Tulov['Tulov']; form1.Tulov.Next; end; if summa<>0 then StatusBar1.Panels[0].Text :=talaba['fio']+'ning tulagan summasi: '+ IntToStr(Summa)+' sum' else StatusBar1.Panels[0].Text :=talaba['fio']+' umuman tulov qilmagan'; end else tulov.Filter:='ID_Talaba<0'; end; procedure TForm1.Yangi1Click(Sender: TObject); begin form5.Tag:=0; form5.p_nomED.Text:=''; form5.P_sanaED.Date:=date; form5.K_sanaED.Date:=date; form5.summaED.Value:=0; form5.ShowModal; end; procedure TForm1.axrirlash2Click(Sender: TObject); begin form5.Tag:=1; form5.p_nomED.Text:=form1.Tulov['p_nom']; form5.P_sanaED.Date:=form1.Tulov['p_sana']; form5.K_sanaED.Date:=form1.Tulov['k_sana']; form5.summaED.Value:=form1.Tulov['summa']; form5.ShowModal; end; Procedure SendtoExcel({ShFile: String;} Querys: TTable); Var ExcelApp, Workbook, Range, Cell1, Cell2, ArrayData: Variant; BeginCol, BeginRow, j,i,Summa: integer; RowCount, ColCount: Integer; Begin BeginCol := 1; BeginRow := 3; // Размеры выводимого массива данных RowCount := Querys.RecordCount; ColCount := Querys.FieldDefs.Count; // Создание Excel ExcelApp := CreateOleObject('Excel.Application'); // Отключаем реакцию Excel на события, чтобы ускорить вывод информации ExcelApp.Application.EnableEvents := false; // Создаем Книгу (Workbook) // Если заполняем шаблон, то Workbook := ExcelApp.WorkBooks.Add(null); ArrayData := VarArrayCreate([1, RowCount, 1, ColCount+1], varVariant); // Заполняем массив Querys.DisableControls; form1.Tulov.DisableControls; Querys.First; i:=0; While Not Querys.eof Do Begin i:=i+1; For J := 1 To Querys.FieldDefs.Count Do Begin ArrayData[i, J] := Querys.FieldbyName(Querys.FieldDefs.Items[j - 1].DisplayName).value; End; form1.Tulov.Filter := 'ID_talaba='+IntToStr(form1.Talaba['ID']); form1.Tulov.First; Summa :=0; While Not form1.Tulov.eof Do Begin Summa := Summa + form1.Tulov['Tulov']; form1.Tulov.Next; end; ArrayData[i, J] := Summa; Querys.Next; End; Querys.EnableControls; form1.Tulov.EnableControls; // Левая верхняя ячейка области, в которую будем выводить данные Cell1 := WorkBook.WorkSheets[1].Cells[BeginRow, BeginCol]; // Правая нижняя ячейка области, в которую будем выводить данные Cell2 := WorkBook.WorkSheets[1].Cells[BeginRow + RowCount - 1, BeginCol + ColCount ]; // Область, в которую будем выводить данные Range := WorkBook.WorkSheets[1].Range[Cell1, Cell2]; // А вот и сам вывод данных // Намного быстрее поячеечного присвоения Range.Value := ArrayData; // Делаем Excel видимым ExcelApp.Visible := True; End; procedure TForm1.BitBtn1Click(Sender: TObject); var s:String; begin // if not InputQuery('Fayl','',S) then exit; // if Trim(S)='' then exit; // SendtoExcel(Path+'\'+S+'.xls', Talaba); , // SendtoExcel('Лист1', Talaba); // SendtoExcel(Talaba); end; procedure TForm1.import1Click(Sender: TObject); begin SendtoExcel(Talaba); end; procedure TForm1.Import2Click(Sender: TObject); var i,kurs,IDG,IDT:integer; GNom,FIO: String; begin memo1.Lines.LoadFromFile(path+'\1.txt'); i:=0; guruh.Filtered := False; Talaba.Filtered := False; while i<=memo1.lines.count-1 do begin kurs:=strtoint(memo1.lines[i]); i:=i+1; GNom:=memo1.lines[i]; i:=i+1; FIO:=memo1.lines[i]; if not Guruh.Locate('Nom',GNOM,[]) then begin Guruh.Append; Guruh['Kurs'] := Kurs; Guruh['Nom'] := GNOM; Guruh['Rahbar'] := '_'; Guruh['R_Tel'] := '_'; Guruh['Sardor'] := '_'; Guruh['S_Tel'] := '_'; Guruh['Summa'] := 0; Guruh.Post; end; IDG := Guruh['ID']; if not Talaba.Locate('FIO',FIO,[]) then begin Talaba.Append; Talaba['Kurs'] := Kurs; Talaba['FIO'] := FIO; Talaba['ID_Guruh'] := IDG; Talaba['Stip1'] := 0; Talaba['Stip2'] := 0; Talaba.Post; end; i:=i+1; end; guruh.Filtered := True; Talaba.Filtered := True; end; procedure TForm1.Chiqish1Click(Sender: TObject); begin close; end; end. 0>0>0> Download 1.52 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling