Skip to content

Commit c7e49d4

Browse files
Initial commit
1 parent a51f48c commit c7e49d4

15 files changed

+9933
-0
lines changed

CPB/ReportTemplate.cbproj

Lines changed: 1303 additions & 0 deletions
Large diffs are not rendered by default.

CPB/ReportTemplate.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//---------------------------------------------------------------------------
2+
3+
#include <vcl.h>
4+
#pragma hdrstop
5+
#include <tchar.h>
6+
//---------------------------------------------------------------------------
7+
USEFORM("uMainForm.cpp", MainForm);
8+
USEFORM("uData.cpp", DataModule1); /* TDataModule: File Type */
9+
//---------------------------------------------------------------------------
10+
int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
11+
{
12+
try
13+
{
14+
Application->Initialize();
15+
Application->MainFormOnTaskBar = true;
16+
Application->CreateForm(__classid(TMainForm), &MainForm);
17+
Application->CreateForm(__classid(TDataModule1), &DataModule1);
18+
Application->Run();
19+
}
20+
catch (Exception &exception)
21+
{
22+
Application->ShowException(&exception);
23+
}
24+
catch (...)
25+
{
26+
try
27+
{
28+
throw Exception("");
29+
}
30+
catch (Exception &exception)
31+
{
32+
Application->ShowException(&exception);
33+
}
34+
}
35+
return 0;
36+
}
37+
//---------------------------------------------------------------------------

CPB/ReportTemplatePCH1.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#include <vcl.h>
2+
#include <tchar.h>
3+

CPB/uData.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//---------------------------------------------------------------------------
2+
3+
4+
#pragma hdrstop
5+
6+
#include "uData.h"
7+
//---------------------------------------------------------------------------
8+
#pragma package(smart_init)
9+
#pragma classgroup "Vcl.Controls.TControl"
10+
#pragma link "dxmdaset"
11+
#pragma resource "*.dfm"
12+
TDataModule1 *DataModule1;
13+
//---------------------------------------------------------------------------
14+
const String DataFileName = "..\\..\\data.dat";
15+
16+
17+
__fastcall TDataModule1::TDataModule1(TComponent* Owner)
18+
: TDataModule(Owner)
19+
{
20+
}
21+
//---------------------------------------------------------------------------
22+
23+

CPB/uData.dfm

Lines changed: 3316 additions & 0 deletions
Large diffs are not rendered by default.

CPB/uData.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//---------------------------------------------------------------------------
2+
3+
#ifndef uDataH
4+
#define uDataH
5+
//---------------------------------------------------------------------------
6+
#include <System.Classes.hpp>
7+
#include "dxmdaset.hpp"
8+
#include <Data.DB.hpp>
9+
//---------------------------------------------------------------------------
10+
class TDataModule1 : public TDataModule
11+
{
12+
__published: // IDE-managed Components
13+
TDataSource *dsProducts;
14+
TDataSource *dsCategories;
15+
TdxMemData *mdCategories;
16+
TAutoIncField *mdCategoriesCategoryID;
17+
TWideStringField *mdCategoriesCategoryName;
18+
TWideMemoField *mdCategoriesDescription;
19+
TBlobField *mdCategoriesPicture;
20+
TdxMemData *mdProducts;
21+
TAutoIncField *mdProductsProductID;
22+
TWideStringField *mdProductsProductName;
23+
TIntegerField *mdProductsSupplierID;
24+
TIntegerField *mdProductsCategoryID;
25+
TWideStringField *mdProductsQuantityPerUnit;
26+
TCurrencyField *mdProductsUnitPrice;
27+
TSmallintField *mdProductsUnitsInStock;
28+
TSmallintField *mdProductsUnitsOnOrder;
29+
TSmallintField *mdProductsReorderLevel;
30+
TBooleanField *mdProductsDiscontinued;
31+
TWideStringField *mdProductsEAN13;
32+
private: // User declarations
33+
public: // User declarations
34+
__fastcall TDataModule1(TComponent* Owner);
35+
};
36+
//---------------------------------------------------------------------------
37+
extern PACKAGE TDataModule1 *DataModule1;
38+
//---------------------------------------------------------------------------
39+
#endif

CPB/uMainForm.cpp

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
//---------------------------------------------------------------------------
2+
3+
#include <vcl.h>
4+
#pragma hdrstop
5+
6+
#include "uMainForm.h"
7+
//---------------------------------------------------------------------------
8+
#pragma package(smart_init)
9+
#pragma link "cxButtons"
10+
#pragma link "cxClasses"
11+
#pragma link "cxControls"
12+
#pragma link "cxCustomData"
13+
#pragma link "cxData"
14+
#pragma link "cxDataStorage"
15+
#pragma link "cxDBData"
16+
#pragma link "cxEdit"
17+
#pragma link "cxFilter"
18+
#pragma link "cxGraphics"
19+
#pragma link "cxGrid"
20+
#pragma link "cxGridCustomTableView"
21+
#pragma link "cxGridCustomView"
22+
#pragma link "cxGridDBTableView"
23+
#pragma link "cxGridLevel"
24+
#pragma link "cxGridTableView"
25+
#pragma link "cxLookAndFeelPainters"
26+
#pragma link "cxLookAndFeels"
27+
#pragma link "cxNavigator"
28+
#pragma link "cxStyles"
29+
#pragma link "dxDateRanges"
30+
#pragma link "dxReport"
31+
#pragma link "dxReport.Backend"
32+
#pragma link "dxReport.ConnectionString.JSON"
33+
34+
#if defined(_WIN64)
35+
#pragma link "dxReport.ConnectionString.JSON.DB.O"
36+
#else
37+
#pragma link "dxReport.ConnectionString.JSON.DB.OBJ"
38+
#endif
39+
40+
41+
#pragma link "dxScrollbarAnnotations"
42+
#pragma link "dxmdaset"
43+
#pragma link "dxShellDialogs"
44+
#pragma resource "*.dfm"
45+
TMainForm *MainForm;
46+
//---------------------------------------------------------------------------
47+
__fastcall TMainForm::TMainForm(TComponent* Owner)
48+
: TForm(Owner)
49+
{
50+
51+
}
52+
//---------------------------------------------------------------------------
53+
54+
//---------------------------------------------------------------------
55+
56+
void __fastcall TMainForm::btnNewClick(TObject *Sender)
57+
{
58+
Caption = "";
59+
dxReport1->ReportName = "";
60+
dxReport1->ShowDesigner();
61+
}
62+
63+
void __fastcall TMainForm::btnOpenClick(TObject *Sender)
64+
{
65+
if (dxOpenFileDialog->Execute())
66+
{
67+
Caption = ChangeFileExt(ExtractFileName(dxOpenFileDialog->FileName), "");
68+
dxReport1->ReportName = Caption;
69+
dxReport1->Layout->LoadFromFile(dxOpenFileDialog->FileName);
70+
}
71+
}
72+
73+
void __fastcall TMainForm::btnSaveClick(TObject *Sender)
74+
{
75+
if (dxReport1->ReportName == "")
76+
{
77+
ShowMessage("Report is not specified");
78+
return;
79+
}
80+
81+
if (dxSaveFileDialog->Execute())
82+
{
83+
dxReport1->ReportName = ChangeFileExt(ExtractFileName(dxSaveFileDialog->FileName), "");
84+
Caption = dxReport1->ReportName;
85+
dxReport1->Layout->SaveToFile(dxSaveFileDialog->FileName);
86+
}
87+
}
88+
89+
void __fastcall TMainForm::btnShowDesignerClick(TObject *Sender)
90+
{
91+
dxReport1->ShowDesigner();
92+
}
93+
94+
void __fastcall TMainForm::btnViewReportClick(TObject *Sender)
95+
{
96+
if (dxReport1->ReportName == "")
97+
{
98+
ShowMessage("Report is not specified");
99+
return;
100+
}
101+
dxReport1->ShowViewer();
102+
}
103+
104+
void __fastcall TMainForm::dxReport1LayoutChanged(TdxReport *ASender)
105+
{
106+
Caption = dxReport1->ReportName;
107+
}
108+
109+
//---------------------------------------------------------------------------
110+

CPB/uMainForm.dfm

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
object MainForm: TMainForm
2+
Left = 0
3+
Top = 0
4+
Caption = 'MainForm'
5+
ClientHeight = 835
6+
ClientWidth = 1040
7+
Color = clBtnFace
8+
Font.Charset = DEFAULT_CHARSET
9+
Font.Color = clWindowText
10+
Font.Height = -12
11+
Font.Name = 'Segoe UI'
12+
Font.Style = []
13+
TextHeight = 15
14+
object btnOpen: TcxButton
15+
Left = 24
16+
Top = 64
17+
Width = 145
18+
Height = 25
19+
Caption = 'Open Report'
20+
SpeedButtonOptions.CanBeFocused = False
21+
TabOrder = 0
22+
OnClick = btnOpenClick
23+
end
24+
object btnViewReport: TcxButton
25+
Left = 320
26+
Top = 80
27+
Width = 193
28+
Height = 25
29+
Caption = 'View Report'
30+
TabOrder = 1
31+
OnClick = btnViewReportClick
32+
end
33+
object cxGrid1: TcxGrid
34+
Left = 40
35+
Top = 184
36+
Width = 521
37+
Height = 265
38+
TabOrder = 2
39+
object gvCategories: TcxGridDBTableView
40+
Navigator.Buttons.CustomButtons = <>
41+
ScrollbarAnnotations.CustomAnnotations = <>
42+
DataController.DataSource = DataModule1.dsCategories
43+
DataController.KeyFieldNames = 'CategoryID'
44+
DataController.Summary.DefaultGroupSummaryItems = <>
45+
DataController.Summary.FooterSummaryItems = <>
46+
DataController.Summary.SummaryGroups = <>
47+
object gvCategoriesCategoryID: TcxGridDBColumn
48+
DataBinding.FieldName = 'CategoryID'
49+
end
50+
object gvCategoriesCategoryName: TcxGridDBColumn
51+
DataBinding.FieldName = 'CategoryName'
52+
end
53+
object gvCategoriesDescription: TcxGridDBColumn
54+
DataBinding.FieldName = 'Description'
55+
end
56+
end
57+
object gvProducts: TcxGridDBTableView
58+
Navigator.Buttons.CustomButtons = <>
59+
ScrollbarAnnotations.CustomAnnotations = <>
60+
DataController.DataSource = DataModule1.dsProducts
61+
DataController.DetailKeyFieldNames = 'CategoryID'
62+
DataController.KeyFieldNames = 'ProductID'
63+
DataController.MasterKeyFieldNames = 'CategoryID'
64+
DataController.Summary.DefaultGroupSummaryItems = <>
65+
DataController.Summary.FooterSummaryItems = <>
66+
DataController.Summary.SummaryGroups = <>
67+
object gvProductsProductID: TcxGridDBColumn
68+
DataBinding.FieldName = 'ProductID'
69+
end
70+
object gvProductsProductName: TcxGridDBColumn
71+
DataBinding.FieldName = 'ProductName'
72+
Width = 244
73+
end
74+
object gvProductsSupplierID: TcxGridDBColumn
75+
DataBinding.FieldName = 'SupplierID'
76+
end
77+
object gvProductsCategoryID: TcxGridDBColumn
78+
DataBinding.FieldName = 'CategoryID'
79+
end
80+
object gvProductsQuantityPerUnit: TcxGridDBColumn
81+
DataBinding.FieldName = 'QuantityPerUnit'
82+
Width = 124
83+
end
84+
object gvProductsUnitPrice: TcxGridDBColumn
85+
DataBinding.FieldName = 'UnitPrice'
86+
end
87+
object gvProductsUnitsInStock: TcxGridDBColumn
88+
DataBinding.FieldName = 'UnitsInStock'
89+
end
90+
object gvProductsUnitsOnOrder: TcxGridDBColumn
91+
DataBinding.FieldName = 'UnitsOnOrder'
92+
end
93+
object gvProductsReorderLevel: TcxGridDBColumn
94+
DataBinding.FieldName = 'ReorderLevel'
95+
end
96+
object gvProductsDiscontinued: TcxGridDBColumn
97+
DataBinding.FieldName = 'Discontinued'
98+
Width = 34
99+
end
100+
object gvProductsEAN13: TcxGridDBColumn
101+
DataBinding.FieldName = 'EAN13'
102+
Width = 76
103+
end
104+
end
105+
object cxGrid1Level1: TcxGridLevel
106+
GridView = gvCategories
107+
object cxGrid1Level2: TcxGridLevel
108+
GridView = gvProducts
109+
end
110+
end
111+
end
112+
object btnNew: TcxButton
113+
Left = 24
114+
Top = 16
115+
Width = 145
116+
Height = 25
117+
Caption = 'New Report'
118+
TabOrder = 3
119+
OnClick = btnNewClick
120+
end
121+
object btnSave: TcxButton
122+
Left = 24
123+
Top = 120
124+
Width = 145
125+
Height = 25
126+
Caption = 'Save Report'
127+
TabOrder = 4
128+
OnClick = btnSaveClick
129+
end
130+
object btnShowDesigner: TcxButton
131+
Left = 320
132+
Top = 32
133+
Width = 193
134+
Height = 25
135+
Caption = 'Show Designer'
136+
TabOrder = 5
137+
OnClick = btnShowDesignerClick
138+
end
139+
object dxReport1: TdxReport
140+
OnLayoutChanged = dxReport1LayoutChanged
141+
Left = 48
142+
Top = 88
143+
end
144+
object dxReportDataConnectionManager1: TdxReportDataConnectionManager
145+
Left = 112
146+
Top = 88
147+
object dxReportDataConnectionManager1dxReportDataSetJSONConnection1: TdxReportDataSetJSONConnection
148+
DisplayName = 'DataSetConnection'
149+
object itmProducts: TdxReportDataSetCollectionItem
150+
DataSet = DataModule1.mdProducts
151+
DataSetAlias = 'mdProducts'
152+
end
153+
object itmCategories: TdxReportDataSetCollectionItem
154+
DataSet = DataModule1.mdCategories
155+
DataSetAlias = 'mdCategories'
156+
end
157+
end
158+
end
159+
object dxOpenFileDialog: TdxOpenFileDialog
160+
Filter = 'REPX (*.repx)|*.repx'
161+
Options = [ofHideReadOnly, ofPathMustExist, ofFileMustExist, ofEnableSizing]
162+
Left = 472
163+
Top = 128
164+
end
165+
object dxSaveFileDialog: TdxSaveFileDialog
166+
DefaultExt = 'repx'
167+
Filter = 'REPX (*.repx)|*.repx'
168+
Left = 464
169+
Top = 216
170+
end
171+
end

0 commit comments

Comments
 (0)