الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

كيفية بناء تقرير ديناميكي بواسطة عناصر Rave.

مغلق
بدأه Aboalnoor-Delphi7 في 27 نوفمبر 2006 · 3 رد · 1,476 مشاهدة · في لغة Delphi
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمة الله وبركاته.

أما بعد :

أخوتي في الله ...

سمعت انه يمكن بناء تقرير دينميكي بواسطة الكود في عناصر الـ Rave.

فارجو ممن لديه خبرة في هذا المجال أن يفيدنا....

وجزاكم الله كل خير.

والله ولي التوفيق.

أخوكم أبو النور.

********************************************************************************

آخر وصايا سيدنا محمد صلى الله عليه وسلم:الصلاة الصلاة وما ملكت أيمانكم

66850879_b6e633000d_m.jpg

هاجر اللذائذ وانبـرى ليثـاً بادغـال الشـرا

بـاع الحيـاة رخيـصـة لله والله اشـتـرى

خذو مني فؤادي وامنحوني سلاحي أمتطي صهو المنون

فإني لم أعش لأذوق ذلاً ولا لأذوب في حضن حنون

موقع الفريق الاسلامي المتحد للبرمجة والإلكترونيات

إيميلي هو:Aboalnoor@maktoob.com

ياهو :adnanalabuo@yahoo.com

هوت ميل:AdnanAlabuo@hotmail.com

مدونتي الخاصة

#2

السلام عليكم ورحمة الله وبركاته

كيفك يا أخ أبو النور

بالنسبة للتقارير يعني والله نحن صرنا ندور على الأسرع و بنفس الوقت أقوى,

نحن نستعمل Report Builder وهي سهلة جداً وسريعة و قوية, إضافة إلى الكثير مثل FAST REPORT

وبالتوفيق ;)

قال تعالى: ((وَمَا أَصَابََكُمْ مِنْ مُصِيبَةٍ فَبمَا كَسَبَتْ أَيْدِيكُمْ وَ يَعْفُو عَنْ كَثِيرٍ)) :.:.: الشورى: الآية 30.

IN ALLAH WE TRUST

:.:.:.:.:.:.:.:.:.:.:.:.:.:

#3

السلام عليكم ورحمة الله وبركاته.

أما بعد :

أخي في الله نريد انشاء تقرير ديناميكي في وقت التشغيل.

وقد سمعت أنه يمكن بناء تقرير ديناميكي بواسطة عناصر الـ Rave والكود بدون الاستعانة ببرنامج التصميم الخاص بها.

والله ولي التوفيق.

أخوكم أبو النور.

********************************************************************************

آخر وصايا سيدنا محمد صلى الله عليه وسلم:الصلاة الصلاة وما ملكت أيمانكم

66850879_b6e633000d_m.jpg

هاجر اللذائذ وانبـرى ليثـاً بادغـال الشـرا

بـاع الحيـاة رخيـصـة لله والله اشـتـرى

خذو مني فؤادي وامنحوني سلاحي أمتطي صهو المنون

فإني لم أعش لأذوق ذلاً ولا لأذوب في حضن حنون

موقع الفريق الاسلامي المتحد للبرمجة والإلكترونيات

إيميلي هو:Aboalnoor@maktoob.com

ياهو :adnanalabuo@yahoo.com

هوت ميل:AdnanAlabuo@hotmail.com

مدونتي الخاصة

#4

انا اسف للتأخر في الرد, المهم هذا موقع يشرح كل ما تريد عمله

Create Reports without Visual Designer

اذا لم تفهم ما هو مكتوب اسأل هنا وسوف اساعدك قدر الاستطاعة

Create a new application. Then drop the following components on your form. No events were used on any of the DataSet or Rave components. 

	 RvSystem (RvSystem1)
	 RvProject (RvProject1) with "Engine" set to "RvSystem1"
	 TTable (pointing to customer type table)
	 DataSource with "DataSet" set to your Ttable
	 RvDataSetConnection with "DataSet" set to your Ttable
	 Button to close the form (optional)
	 Button to "execute" the on-the-fly report with an OnClick event

You must use a data table that has "Last", "First", "Street", "City", "State" and "Zip" columns (fields) in it or adjust the "DataText" areas to meet your table structure. The following code includes the "button" OnClick event 

Delphi: 

Unit Unit1;

Interface

Uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  DB, Dialogs, StdCtrls, Buttons, Math, ApoDSet,
  RpBase, RpCon, RpConDS, RpDefine, RpDevice, RpRave, RpSystem,
  RvClass, RvCsData, RvCsDraw, RvCsStd, RvCsRpt, RvData, RvDefine, RvDirectDataView, RvUtil;

Type
  TForm1 = Class(TForm)
	ApolloTable1: TApolloTable;
	btnClose: TBitBtn;
	btnReport: TButton;
	DataSource1: TDataSource;
	RvDataSetConnection1: TRvDataSetConnection;
	RvProject1: TRvProject;
	RvSystem1: TRvSystem;
	Procedure btnReportClick(Sender: TObject);
  private
	{ Private declarations }
  public
	{ Public declarations }
  End;

Var
  Form1: TForm1;

Implementation

{$R *.dfm}

Procedure TForm1.btnReportClick(Sender: TObject);
Var
  MyBand, MyTitleBand: TRaveBand;
  MyDataBand: TRaveDataBand;
  MyDataCnx: TRaveDataConnection;
  MyDataText: TRaveDataText;
  MyDataView: TRaveDataView;
  MyLine: TRaveHLine;
  MyPage: TRavePage;
  MyRegion: TRaveRegion;
  MyText: TRaveText;
  nMarginBottom, nMarginLeft, nMarginRight, nMarginTop: Double;
  // I1: integer;
Begin
  // Select the project file
  // RvProject1.ProjectFile := 'Project1.rav';
  // RvProject1.Open;
  //	 OR
  RvProject1.New;

  // 1 - use a blank page "Page 1 in Report 1" ======================
  MyPage := RvProject1.ProjMan.FindRaveComponent('Report1.Page1', Nil) As TRavePage;
  MyPage.WasteFit := True;
  // Set all margins to “waste” or 0.5 which ever is greater
  nMarginBottom := MaxValue([RpDev.Waste.Bottom / RpDev.YDPI, 0.5]);
  nMarginLeft := MaxValue([RpDev.Waste.Left / RpDev.XDPI, 0.5]);
  nMarginRight := MaxValue([RpDev.Waste.Right / RpDev.XDPI, 0.5]);
  nMarginTop := MaxValue([RpDev.Waste.Top / RpDev.YDPI, 0.5]);

  // If you need to Delete all components on the page
  //for I1 := MyPage.ComponentCount - 1 downto 0 do begin
  //  MyPage.Components[I1].Free;
  //end;

  // 2 - Create DataView using Connection ===========================
  MyDataCnx := CreateDataCon(RvDatasetConnection1);
  MyDataView := RvProject1.ProjMan.NewDataObject(TRaveDataView) As TRaveDataView;
  MyDataView.ConnectionName := MyDataCnx.Name;
  MyDataView.DataCon := MyDataCnx;
  CreateFields(MyDataView, Nil, Nil, true);
  // 2a - place “Page Number” directly ON the page NOT a band
  MyDataText := MyPage.CreateChild(TRaveDataText, 'dtPage') As TRaveDataText;
  MyDataText.DataField := '"Page of " + Report.CurrentPage + " of " + Report.TotalPages';
  MyDataText.FontJustify := pjRight;
  MyDataText.Width := 2; // Width MUST be before LEFT assignment
  MyDataText.Left := MyPage.PageWidth - nMarginRight - MyDataText.Width;
  MyDataText.Top := nMarginTop;
  // 2b - place “Date” directly ON the page NOT a band
  MyDataText := MyPage.CreateChild(TRaveDataText, 'dtDate') As TRaveDataText;
  MyDataText.DataField := 'Report.DateLong';
  MyDataText.FontJustify := pjRight;
  MyDataText.Width := 2; // Width MUST be before LEFT assignment
  MyDataText.Left := MyPage.PageWidth - nMarginRight - MyDataText.Width;
  MyDataText.Top := nMarginTop + 0.2;

  // 3 - create a region and set it's properties ====================
  MyRegion := TRaveRegion.Create(MyPage);
  MyRegion.Left := nMarginLeft;
  MyRegion.Name := 'Region1';
  MyRegion.Parent := MyPage;
  MyRegion.Top := nMarginTop + 0.4; // Top MUST be before HEIGHT assignment
  MyRegion.Width := MyPage.PageWidth - (nMarginLeft + nMarginRight);
  MyRegion.Height := MyPage.PageHeight - (MyRegion.Top + nMarginBottom);

  // 4 - Create Databand named "DetailBand" First (controller) ======
  MyDataBand := MyRegion.CreateChild(TRaveDataBAnd, 'DetailBand') As TRaveDataBand;
  MyDataBand.DataView := MyDataView; // Always set the band dataview property
  // 4a - Place DataText components in "DetailBand" just created
  MyDataText := MyDataBand.CreateChild(TRaveDataText, 'dtName') As TRaveDataText;
  // concatenate fields with comma between them
  MyDataText.DataField := 'Last' + ' + ", " + ' + 'First';
  MyDataText.DataView := MyDataView;
  MyDataText.FontJustify := pjLeft;
  MyDataText.Left := MyPage.PageLeft + 0.2;
  MyDataText.Top := 0.01;
  MyDataText.Width := 2;
  // 4b
  MyDataText := MyDataBand.CreateChild(TRaveDataText, 'dtStreet') As TRaveDataText;
  MyDataText.DataField := 'Street';
  MyDataText.DataView := MyDataView;
  MyDataText.FontJustify := pjLeft;
  MyDataText.Left := MyPage.PageLeft + 2.1;
  MyDataText.Top := 0.01;
  MyDataText.Width := 2;
  // 4c
  MyDataText := MyDataBand.CreateChild(TRaveDataText, 'dtCityStZip') As TRaveDataText;
  // concatenate fields with space between them
  MyDataText.DataField := 'City' + ' & ' + 'State' + ' & ' + 'Zip';
  MyDataText.DataView := MyDataView;
  MyDataText.FontJustify := pjLeft;
  MyDataText.Left := MyPage.PageLeft + 4.1;
  MyDataText.Top := 0.01;
  MyDataText.Width := 2;

  // 5 - Create Header Band controlled by "DetailBand" ==============
  MyBand := MyRegion.CreateChild(TRaveBand, 'HeaderBand') As TRaveBand;

  //	  BandStyle Print Location codes
  // BandStyle PrintLoc b plBodyFooter
  // BandStyle PrintLoc g plGroupFooter
  // BandStyle PrintLoc r plRowFooter
  // BandStyle Printloc D plDetail
  // BandStyle Printloc R plRowHeader
  // BandStyle Printloc G plGroupHeader
  // BandStyle Printloc B plBodyHeader
  MyBand.BandStyle.PrintLoc := MyBand.BandStyle.PrintLoc + [plBodyHeader];

  //	  BandStyle Print Occurrence codes
  // BandStyle PrintOcc C poNewColumn
  // BandStyle PrintOcc P poNewPage
  // BandStyle PrintOcc 1 poFirst
  MyBand.BandStyle.PrintOcc := MyBand.BandStyle.PrintOcc + [poFirst, poNewPage];

  MyBand.ControllerBand := MyDataBand;
  MyBand.Height := 0.2;
  MyBand.Left := MyRegion.Left;
  MyBand.MoveBehind; // Looks better when you "view it"
  MyBand.Top := MyRegion.Top;
  MyBand.Width := MyRegion.Width;

  // 5a - Place Text components in "HeaderBand" just created
  MyText := MyBand.CreateChild(TRaveText, 'TextName') As TRaveText;
  MyText.Left := MyBand.Left + 0.2;
  MyText.Top := 0.01; // Band.Top ???
  MyText.Font.Size := 10;
  MyText.Font.Style := MyText.Font.Style + [fsBold];
  MyText.FontJustify := pjLeft;
  MyText.Text := 'Surname, First';
  MyText.Width := 2; // DataText.Name.dtName.width ???
  // 5b
  MyText := MyBand.CreateChild(TRaveText, 'TextStreet') As TRaveText;
  MyText.Left := MyBand.Left + 2.1; // prior text + 0.1 ???
  MyText.Top := 0.01; // Band.Top ???
  MyText.Font.Size := 10;
  MyText.Font.Style := MyText.Font.Style + [fsBold];
  MyText.FontJustify := pjCenter;
  MyText.Text := 'Street';
  MyText.Width := 2; // DataText.Name.dtName.width ???
  // 5c
  MyText := MyBand.CreateChild(TRaveText, 'TextStreet') As TRaveText;
  MyText.Left := MyBand.Left + 4.1; // prior text + 0.1 ???
  MyText.Top := 0.01;
  MyText.Font.Size := 10;
  MyText.Font.Style := MyText.Font.Style + [fsBold];
  MyText.FontJustify := pjCenter;
  MyText.Text := 'City State Zip';
  MyText.Width := 2; // DataText.Name.dtName.width ???
  // 5d - draw a horizontal line
  MyLine := MyBand.CreateChild(TRaveHLine, 'BottomLine') As TRaveHLine;
  MyLine.Left := 0; // MyBand.Left;
  MyLine.LineWidth := 2;
  //MyLine.LineWidthType := wtPoints;
  MyLine.Top := MyBand.Height - 0.01;
  MyLine.Width := MyRegion.Width;

  // 6 - Create Report Title Band controlled by "DetailBand" ========
  MyTitleBand := MyRegion.CreateChild(TRaveBand, 'TitleBand') As TRaveBand;
  MyTitleBand.ControllerBand := MyDataBand;
  MyTitleBand.MoveBehind; // Looks better when you "view it"
  MyTitleBand.MoveBehind;
  MyTitleBand.BandStyle.PrintLoc := MyTitleBand.BandStyle.PrintLoc + [plBodyHeader];
  MyTitleBand.Left := MyRegion.Left;
  MyTitleBand.Width := MyRegion.Width;
  MyTitleBand.Height := 0.35;
  // 6a - Create Text component for "Report Title"
  MyText := MyTitleBand.CreateChild(TRaveText, 'TitleText') As TRaveText;
  MyText.Left := MyTitleBand.Left;
  MyText.Top := 0.01;
  MyText.Font.Size := 20;
  MyText.FontJustify := pjCenter;
  MyText.Text := 'Sample Members Report';
  MyText.Width := MyTitleBand.Width;

  // 7 - OK, run it =================================================
  RvProject1.ExecuteReport('Report1');
  // ONLY use this so you can view report design
  // RvProject1.ProjectFile := 'ProjectTest.rav';
  // RvProject1.Save; 
  RvProject1.Close;
End;
End.

رب اجعلني مقيم الصلاة ومن ذريتي ربنا وتقبل دعاء.

لا تنسى: "العقل مثل العضلة كلما استخدمته أكثر كلما ازدادت قوته"

هذا الموضوع مغلق.

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…