Гбпоу актт. 09. 02. 04. Пз2016
Скачать 0.85 Mb.
|
«Экономика России»/ Республика Башкортостан. Основные сведения/ Официальный сайт «Экономика и право 230 стран. Связи с Россией» / Электронная версия журнала «Эксперт» № 12 (553) апрель 2010/ Независимость от сырья/ Приложение Программныйкодглавнойформы unitUnit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, ADODB, Grids, DBGrids, StdCtrls, DBGridEhGrouping, ToolCtrlsEh, DBGridEhToolCtrls, DynVarsEh, GridsEh, DBAxisGridsEh, DBGridEh, Mask, DBCtrlsEh, ScktComp, ComCtrls, EhLibVCL, sSkinManager,ShellAPI; type TForm1 = class(TForm) btn1: TButton; btn2: TButton; btn3: TButton; btn4: TButton; btn5: TButton; btn6: TButton; edt1: TDBEditEh; edt2: TDBEditEh; edt3: TDBEditEh; dlgOpen1: TOpenDialog; ds1: TDataSource; con1: TADOConnection; qry1: TADOQuery; DBGridEh1: TDBGridEh; btn8: TButton; Button1: TButton; Button2: TButton; sSkinManager1: TsSkinManager; procedureFormCreate(Sender: TObject); procedure btn2Click(Sender: TObject); procedure btn6Click(Sender: TObject); procedure btn1Click(Sender: TObject); procedure btn3Click(Sender: TObject); procedure btn5Click(Sender: TObject); procedure btn4Click(Sender: TObject); procedure btn8Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedureFormShow(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation uses Unit2, Unit3, Unit4, Unit5; {$R *.dfm} functionExecuteFile(constFileName, Params, DefaultDir: string; ShowCmd: Integer): THandle; begin Result :=ShellExecute(Application.MainForm.Handle, nil, PChar(FileName), PChar(Params), PChar(DefaultDir), ShowCmd); end; procedure TForm1.FormCreate(Sender: TObject); begin dbgrideh1.Columns[1].Width:=100; dbgrideh1.Columns[2].Width:=130; dbgrideh1.Columns[3].Width:=160; dbgrideh1.Columns[4].Width:=130; dbgrideh1.Columns[5].Width:=160; dbgrideh1.Columns[6].Width:=130; dbgrideh1.Columns[0].Width:=40; dbgrideh1.Columns[0].Visible:=False; end; procedure TForm1.btn2Click(Sender: TObject); begin qry1.Delete; end; procedure TForm1.btn6Click(Sender: TObject); begin Form2.show; form2.btn1.Visible:=true; form2.btn2.Visible:=true; end; procedure TForm1.btn1Click(Sender: TObject); begin form2.show; form2.btn1.Visible:=true; form2.btn2.Visible:=true; form2.btn3.Visible:=False; Form1.qry1.insert; end; procedure TForm1.btn3Click(Sender: TObject); begin Close; end; procedure TForm1.btn5Click(Sender: TObject); begin Edt1.text:=''; Edt2.text:=''; Edt3.text:=''; Btn4Click(Sender); DBGrideh1.Columns[0].Visible := False; DBGrideh1.Columns[1].Visible := true; DBGrideh1.Columns[2].Visible := true; DBGrideh1.Columns[3].Visible := true; DBGrideh1.Columns[4].Visible := true; DBGrideh1.Columns[5].Visible := true; DBGrideh1.Columns[6].Visible := true; end; procedure TForm1.btn4Click(Sender: TObject); begin qry1.Active := False; Qry1.SQL.Clear; Qry1.SQL.Add('SELECT *'); Qry1.SQL.Add('FROM таблица1'); Qry1.SQL.Add('WHERE ФИО_завкаб LIKE' + #39 + Edt1.Text + '%' + #39 +' AND '); Qry1.SQL.Add('[Номер_кабинета] LIKE' + #39 + Edt2.Text + '%' + #39 +' AND '); Qry1.SQL.Add('Дата_поломки LIKE' + #39 + Edt3.Text + '%' + #39); Qry1.Active := True; end; procedure TForm1.btn8Click(Sender: TObject); begin Form2.btn1.Visible:=false; Form2.Show; end; procedure TForm1.Button1Click(Sender: TObject); begin form4.show; end; procedure TForm1.FormShow(Sender: TObject); begin AnimateWindow(handle, 500, AW_VER_POSITIVE); end; procedure TForm1.Button2Click(Sender: TObject); begin ExecuteFile('IT_Tech.exe','','',SW_SHOW) end; end. Программный код формы редактирования unit Unit2; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Mask, DBCtrlsEh,ComObj; type TForm2 = class(TForm) btn1: TButton; btn2: TButton; btn3: TButton; lbl1: TLabel; lbl4: TLabel; lbl6: TLabel; lbl7: TLabel; edt_: TDBEditEh; edt_5: TDBEditEh; edt_6: TDBEditEh; lbl9: TLabel; lbl11: TLabel; edt_8: TDBEditEh; edt3: TDBEditEh; edt_3: TDBEditEh; procedure btn1Click(Sender: TObject); procedure btn2Click(Sender: TObject); procedure btn3Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form2: TForm2; implementation uses Unit1; {$R *.dfm} procedure TForm2.btn1Click(Sender: TObject); begin Form1.Qry1.Post; end; procedure TForm2.btn2Click(Sender: TObject); begin form2.Hide; end; procedure TForm2.btn3Click(Sender: TObject); var i,j, index: Integer; ExcelApp,sheet: Variant; begin ExcelApp :=CreateOleObject('Excel.Application'); ExcelApp.Visible := False; ExcelApp.WorkBooks.Add(-4167); ExcelApp.WorkBooks[1].WorkSheets[1].name := 'Zayavka'; sheet:=ExcelApp.WorkBooks[1].WorkSheets['Zayavka']; ExcelApp.Range['b6']:=edt_.text; ExcelApp.Range['c6']:=edt_3.Text; ExcelApp.Range['d6']:=edt_5.Text; ExcelApp.Range['e6']:=edt_6.text; ExcelApp.Range['f6']:=edt_8.text; ExcelApp.Range['g6']:=edt3.text; ExcelApp.Visible := true; ExcelApp.Range['a1:a45']:=''; ExcelApp.Range['b5']:='Фиозавкаб'; ExcelApp.Range['c5']:='Номеркабинета'; ExcelApp.Range['d5']:='Видполомки'; ExcelApp.Range['e5']:='Датаполомки'; ExcelApp.Range['f5']:='Исполнитель'; ExcelApp.Range['g5']:='Статус'; ExcelApp.Range['c3']:='Отчет по заявке'; Excelapp.Range['c3:e3'].Select; Excelapp.Selection.MergeCells:=True; Excelapp.Selection.HorizontalAlignment:=3; Excelapp.Range['a1:a8'].Select; Excelapp.Selection.HorizontalAlignment:=3; ExcelApp.Range['a1']:='Министерствообразования'; ExcelApp.Range['a2']:='Нижегородскойобласти'; ExcelApp.Range['a3']:='Государственное бюджетное'; ExcelApp.Range['a4']:='профессиональное учреждение'; ExcelApp.Range['a5']:='"Арзамасский коммерческо-'; ExcelApp.Range['a6']:='технический техникум"'; ExcelApp.Range['c8']:='Подпись:__________________'; ExcelApp.Range['e8']:='ЗайцевЕ.Г.'; ExcelApp.Range['a7']:='"__"____________20__г.'; ExcelApp.Range['a8']:='г.Арзамас'; Excelapp.Selection.WrapText:=True; ExcelApp.Columns.Range['b5',EmptyParam].ColumnWidth:=15; ExcelApp.Columns.Range['c5',EmptyParam].ColumnWidth:=15; ExcelApp.Columns.Range['d5',EmptyParam].ColumnWidth:=13; ExcelApp.Columns.Range['e5',EmptyParam].ColumnWidth:=14; ExcelApp.Columns.Range['f5',EmptyParam].ColumnWidth:=13; ExcelApp.Columns.Range['g5',EmptyParam].ColumnWidth:=9; ExcelApp.Columns.Range['a1',EmptyParam].ColumnWidth:=33; ExcelApp.WorkBooks[1].WorkSheets[1].Range['b1:g25'].Font.Name :='Times New Roman'; ExcelApp.WorkBooks[1].WorkSheets[1].Range['b5:g5'].Font.Bold := True; ExcelApp.WorkBooks[1].WorkSheets[1].Range['b5:g6'].Borders.LineStyle := 1; ExcelApp.WorkBooks[1].WorkSheets[1].Range['c3:e3'].Borders.LineStyle := 1; ExcelApp.WorkBooks[1].SaveAs(GetCurrentDir() + '\Отчет.xlsx') end; end. |