Диплом: Автоматизация управленческого учета основных средств в ООО «Агровит»

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
126
except
TypeTextDoc:=false;
end;
End;
Function FindAndPasteTextDoc(findtext_,pastetext_:string):boolean;
begin
FindAndPasteTextDoc:=true;
try
W.Selection.Find.Forward:=true;
W.Selection.Find.Text:= findtext_;
if W.Selection.Find.Execute then begin
W.Selection.Delete;
W.Selection.InsertAfter (pastetext_);
end else FindAndPasteTextDoc:=false;
except
FindAndPasteTextDoc:=false;
end;
End;
Function FindAndInsert(FindText,ReplacementText:string):boolean;
const wdReplaceAll=2;
begin
W. Selection.Find.Text:=FindText;
W.Selection.Find.Replacement.Text:=ReplacementText;
FindAndInsert:=W.Selection.Find.Execute(Replace:=wdReplaceAll);
end;
Function DialogWord(Dialog:Wdunits):boolean;
begin
DialogWord:=true;
try
W.Dialogs.Item(Dialog).Show;
except
DialogWord:=false;
end;
End;
Function SetFont(FontName:WdFonts):boolean;
begin
W.Selection.Style:=(FontName);
end;
//----------- Таблицы --------------------------------------------------
Function CreateTable(NumRows, NumColumns:integer;var index:integer):boolean;
var Range:variant;
begin
CreateTable:=true;
try
EndOfDoc;
127
W.ActiveDocument.Tables.Add(W.Selection.Range, NumRows:=NumRows,
NumColumns:=NumColumns);
index:=W.ActiveDocument.Tables.Count;
W.ActiveDocument.Tables.Item(index).Borders.Enable:=true;
W.ActiveDocument.Range.InsertAfter(' ');
except
CreateTable:=false;
end;
End;
Procedure GetWordTablesCellValue(Table,Row,Column:integer;var S:string);
begin
S:=W.ActiveDocument.Tables.Item(Table).Cell(Row,Column).Range.Text;
S:=StringReplace(S, #$D,'',[rfReplaceAll]);
S:=StringReplace(S, #$7,'',[rfReplaceAll]);
end;
Procedure SetWordTablesCellValue(Table,Row,Column:integer;S:string);
begin
W.ActiveDocument.Tables.Item(Table).Cell(Row,Column).Range.Text:=S;
end;
procedure GetTableInStringGrid(Table:integer;var StringGrid:TStringGrid);
var
S:string;
i,j,icols,irows:integer;
begin
try
irows:=W.ActiveDocument.Tables.Item(Table).Rows.Count;
icols:=W.ActiveDocument.Tables.Item(Table).Columns.Count;
StringGrid.RowCount:=irows;
StringGrid.ColCount:=icols;
for i:=1 to irows do
begin
for j:=1 to icols do
begin
GetWordTablesCellValue(Table,i,j,S);
StringGrid.Cells[j-1,i-1]:=S;
end;
end;
except
end;
end;
procedure GetStringGridInTable(StringGrid:TStringGrid;var Table:integer);
var
S:string;
icols,irows,iGridRows,jGridCols:integer;
begin
try
iCols:=StringGrid.ColCount;
128
iRows:=StringGrid.RowCount;
CreateTable(iRows,iCols,Table);
for iGridRows := 1 to iRows do
for jGridCols := 1 to iCols do
W.ActiveDocument.Tables.Item(Table).Cell(iGridRows, jGridCols).Range.Text:=
StringGrid.Cells[jGridCols - 1, iGridRows - 1];
W.ActiveDocument.Range.InsertAfter(' ');
Table:=W.ActiveDocument.Tables.Count;
W.ActiveDocument.Tables.Item(Table).AutoFitBehavior(wdAutoFitContent);
InsertParagraphAfterTable(Table);
except
end;
end;
procedure GetStringGridInTable2(StringGrid:TStringGrid;var
Table:integer;ColArr:array of integer);
var
S:string;
icols,irows,iGridRows,jGridCols:integer;
begin
try
iCols:=Length(ColArr);
iRows:=StringGrid.RowCount;
CreateTable(iRows,iCols,Table);
for iGridRows := 1 to iRows do
for jGridCols := Low(ColArr) to High(ColArr) do
W.ActiveDocument.Tables.Item(Table).Cell(iGridRows, jGridCols+1).Range.Text:=
StringGrid.Cells[ColArr[jGridCols], iGridRows - 1];
W.ActiveDocument.Range.InsertAfter(' ');
Table:=W.ActiveDocument.Tables.Count;
W.ActiveDocument.Tables.Item(Table).AutoFitBehavior(wdAutoFitContent);
InsertParagraphAfterTable(Table);
except
end;
end;
procedure WordTableAddFromDBGrid(DBGrid: TDBGrid;CollSize:boolean;var
Table:integer);
var i, j,Col,Row,ColWidth: Integer;
S:string;
begin
Col:=DBGrid.Columns.Count;
Row:=DBGrid.DataSource.DataSet.RecordCount+1;
//SetTextToDoc(DBGrid.Columns.Items[0].Title.Caption,true);
CreateTable(Row,Col,Table);
if CollSize then ColWidth:=DBGrid.Columns.Items[0].Width;
//W.Selection.Tables.Item(Table).Columns.Item(1).SetWidth(ColumnWidth:=ColWidth,R
ulerStyle:=wdAdjustNone);
For j:=0 To Col-1 Do
129
begin
S:=DBGrid.Columns.Items[j].Title.Caption;
SetWordTablesCellValue(Table,1,j+1,S);
if CollSize then ColWidth:=DBGrid.Columns.Items[j].Width;
//W.Selection.Tables.Item(Table).Columns.Item(j+1).
// SetWidth(ColumnWidth:=ColWidth,RulerStyle:=wdAdjustNone);
end;
DBGrid.DataSource.DataSet.First;
For i:=1 To Row-1 Do
begin
For j:=0 To Col-1 Do
SetWordTablesCellValue(Table,i+1,j+1,DBGrid.Columns.Items[j].Field.AsString);
DBGrid.DataSource.DataSet.Next;
end;
DBGrid.DataSource.DataSet.First;
W.ActiveDocument.Tables.Item(Table).AutoFitBehavior(wdAutoFitContent);
end;
Function SetSizeTable(Table:integer;RowsHeight, ColumnsWidth:real):boolean;
begin
SetSizeTable:=true;
try
W.ActiveDocument.Tables.Item(Table).Columns.Width:=ColumnsWidth;
W.ActiveDocument.Tables.Item(Table).Rows.Height:=RowsHeight;
except
SetSizeTable:=false;
end;
End;
Function GetSizeTable(Table:integer;var RowsHeight,ColumnsWidth:real):boolean;
begin
GetSizeTable:=true;
try
ColumnsWidth:=W.ActiveDocument.Tables.Item(Table).Columns.Width;
RowsHeight:=W.ActiveDocument.Tables.Item(Table).Rows.Height;
except
GetSizeTable:=false;
end;
End;
Function SetHeightRowTable(Table,Row:integer;RowHeight:real):boolean;
begin
SetHeightRowTable:=true;
try
W.ActiveDocument.Tables.Item(Table).Rows.item(Row).Height:=RowHeight;
except
SetHeightRowTable:=false;
end;
End;
Function GetHeightRowTable(Table,Row:integer;var RowHeight:real):boolean;
130
begin
GetHeightRowTable:=true;
try
RowHeight:=W.ActiveDocument.Tables.Item(Table).Rows.item(Row).Height;
except
GetHeightRowTable:=false;
end;
End;
Function SetWidthColumnTable(Table,Column:integer;ColumnWidth:real):boolean;
begin
SetWidthColumnTable:=true;
try
W.ActiveDocument.Tables.Item(Table).Columns.Item(Column).Width:=ColumnWidth;
except
SetWidthColumnTable:=false;
end;
End;
Function GetWidthColumnTable(Table,Column:integer;var ColumnWidth:real):boolean;
begin
GetWidthColumnTable:=true;
try
ColumnWidth:=W.ActiveDocument.Tables.Item(Table).Columns.Item(Column).Width;
except
GetWidthColumnTable:=false;
end;
End;
Function SetTextToTable(Table:integer;Row,Column:integer;text:string):boolean;
begin
SetTextToTable:=true;
try
W.ActiveDocument.Tables.Item(Table).Columns.Item(Column).Cells.Item(Row).Range.T
ext:=text;
except
SetTextToTable:=false;
end;
End;
Procedure GetTextFromTable(Table:integer;Row,Column:integer;var text:string);
begin
try
text:=W.ActiveDocument.Tables.Item(Table).Columns.Item(Column).Cells.Item(Row).Ra
nge.Text;
except
end;
End;
131
Function
SetLineStyleBorderTable(Table:integer;Row,Column,wdBorderType,wdBorderStyle:wdU
nits):boolean;
begin
SetLineStyleBorderTable:=true;
try
W.ActiveDocument.Tables.Item(Table).Columns.Item(Column).Cells.Item(Row).Borders.
Item(wdBorderType).LineStyle:=wdBorderStyle;
except
SetLineStyleBorderTable:=false;
end;
End;
Function
SetMergeCellsTable(Table:integer;Row1,Column1,Row2,Column2:integer):boolean;
var cel_:variant;
begin
SetMergeCellsTable:=true;
try
cel_:=W.ActiveDocument.Tables.Item(Table).Cell(Row2,Column2);
W.ActiveDocument.Tables.Item(Table).Cell(Row1,Column1).Merge(cel_);
except
SetMergeCellsTable:=false;
end;
End;
Function CopyHereRawFromTable(table,Row1,Row2:integer):boolean;
var
Here:integer;
begin
Here:=W.Selection.Start;
W.Selection.Start:=W.ActiveDocument.Tables.Item(Table).Rows.Item(Row1).Range.start
;
W.Selection.End:=W.ActiveDocument.Tables.Item(Table).Rows.Item(Row2).Range.end;
W.Selection.Copy;
W.Selection.Start:=Here;
W.Selection.PasteAndFormat (0);
end;
procedure TableAutoFit(Table:integer);
begin
W.ActiveDocument.Tables.Item(Table).AutoFitBehavior(wdAutoFitContent);
end;
Procedure MakeNewLineInTable(Table,AfterRow,NewRowCount:integer);
begin
try
W.ActiveDocument.Tables.Item(Table).Rows.Item(AfterRow).Select;
W.Selection.InsertRowsBelow(NewRowCount);
except
end;
132
End;
Procedure DeleteRowInTable(Table,Row:integer);
begin
try
W.ActiveDocument.Tables.Item(Table).Rows.Item(Row).Select;
W.Selection.Rows.Delete;
except
end;
End;
procedure InsertPicture(FileName:string);
begin
W.Selection.InlineShapes.AddPicture(FileName);
W.ActiveDocument.Range.InsertParagraphAfter;
end;
end.
unit Unit_Amort;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.DBCtrls, Vcl.ExtCtrls, Vcl.StdCtrls,
Vcl.Mask;
type
TForm_Amort = class(TForm)
Label2: TLabel;
Label4: TLabel;
Label5: TLabel;
DBLookupComboBox1: TDBLookupComboBox;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
Button2: TButton;
Button1: TButton;
DBNavigator1: TDBNavigator;
Button3: TButton;
Panel1: TPanel;
DBText1: TDBText;
Label1: TLabel;
DBLookupComboBox2: TDBLookupComboBox;
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
133
end;
var
Form_Amort: TForm_Amort;
implementation
{$R *.dfm}
uses datamod;
procedure TForm_Amort.Button1Click(Sender: TObject);
begin
datamod.dm.Table_Amort.Post;
datamod.dm.Table_Amort.Refresh;
end;
procedure TForm_Amort.Button2Click(Sender: TObject);
begin
Form_Amort.Close;
datamod.dm.Table_Amort.Close;
end;
procedure TForm_Amort.Button3Click(Sender: TObject);
begin
if MessageDlg('Подтвердите удаление записи', mtConfirmation,[mbOK, mbCancel],0)
= mrOK then
datamod.dm.Table_Amort.Delete;
end;
end.
unit Unit_Dvig;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.DBCtrls, Vcl.ExtCtrls, Vcl.StdCtrls,
Vcl.Mask;
type
TForm_Dvig = class(TForm)
Label2: TLabel;
Label4: TLabel;
Label5: TLabel;
Label1: TLabel;
DBLookupComboBox1: TDBLookupComboBox;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
Button2: TButton;
Button1: TButton;
DBNavigator1: TDBNavigator;
Button3: TButton;
Panel1: TPanel;
Label3: TLabel;
DBLookupComboBox2: TDBLookupComboBox;
134
DBLookupComboBox3: TDBLookupComboBox;
DBText1: TDBText;
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_Dvig: TForm_Dvig;
implementation
{$R *.dfm}
uses datamod;
procedure TForm_Dvig.Button1Click(Sender: TObject);
begin
datamod.dm.Table_Dvig.Post;
datamod.dm.Table_Dvig.Refresh;
end;
procedure TForm_Dvig.Button2Click(Sender: TObject);
begin
Form_Dvig.Close;
end;
procedure TForm_Dvig.Button3Click(Sender: TObject);
begin
if MessageDlg('Подтвердите удаление записи', mtConfirmation,[mbOK, mbCancel],0)
= mrOK then
datamod.dm.Table_Dvig.Delete;
end;
end.
unit Unit_Modern;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.DBCtrls, Vcl.ExtCtrls, Vcl.StdCtrls,
Vcl.Mask;
type
TForm_Modern = class(TForm)
Label2: TLabel;
Label4: TLabel;
Label5: TLabel;
DBLookupComboBox1: TDBLookupComboBox;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
135
Button2: TButton;
Button1: TButton;
DBNavigator1: TDBNavigator;
Button3: TButton;
Panel1: TPanel;
DBText1: TDBText;
Label1: TLabel;
DBLookupComboBox2: TDBLookupComboBox;
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_Modern: TForm_Modern;
implementation
{$R *.dfm}
uses datamod;
procedure TForm_Modern.Button1Click(Sender: TObject);
begin
datamod.dm.Table_Modern.Post;
datamod.dm.Table_Modern.Refresh;
end;
procedure TForm_Modern.Button2Click(Sender: TObject);
begin
Form_Modern.Close;
datamod.dm.Table_Modern.Close;
end;
procedure TForm_Modern.Button3Click(Sender: TObject);
begin
if MessageDlg('Подтвердите удаление записи', mtConfirmation,[mbOK, mbCancel],0)
= mrOK then
datamod.dm.Table_Modern.Delete;
end;
end.
unit Unit_NewOS;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Mask, Vcl.DBCtrls;
type
TFormNewOS = class(TForm)
Label1: TLabel;

Смотрите также:

"Автоматизация обработки заявок ООО "Проектно-Строительная Компания"
"Автоматизация процесса аттестации персонала для ООО "Нэт Бай Нэт Холдинг"
"Анализ интернет-активности конкурентов ( на примере конкурентов "Газпром нефть")
"Бухгалтерский учёт и аудит расчётов с подотчётними лицами в организации на примере ООО "ЛОЦ 10""
«Психологическое сопровождение персонала в организации на примере ООО «Крокус»
Agile-методология в управлении проектами на примере ООО «Ресурсный центр «Академия КлассИнфо»
Aвтoмaтизaция пpoцecca вeдeния инфopмaциoннoй бaзы o дoлжнocтяx и вaкaнcияx c укaзaниeм тpeбoвaний к уpoвню знaний и нaвыкoв кaндидaтoв для гpуппы кaдpoв вoйcкoвoй чacти 3474»
Cовершенствование деловой оценки персонала в организации (на примере ООО "Даймонд кейтеринг развитие")
Cовершенствование управления рентабельности предприятия (на примере гуипп «бендерская типография «полиграфист»)
Event - менеджмент: реализация проекта (на примере ООО "АГРОПАК")