Topic: Hijri date

hi

i have try to use HIJRI date in my project
1- i try normal DATE from software and just change date format of windows works fine for me as select date in database and show it in tablegrid and search between dates  but not for report when i try to report/print will not show HIJRI date will show me normal date even the windows on hijri DATES

2- i tried to use other method of combobox and made hijri data with combobox and use calculate filed to show it in tablegrid in one cell  all works fine for but i faced the problem of search between date in groups and show it in tablegrid for report ect ..... 

so whatu advice me so i can use hijri date and can search betwwen dates and report it fine thanks

Re: Hijri date

any body can help please ?

Re: Hijri date

I'll try to help you, but just need some time to test t.

Dmitry.

Re: Hijri date

thanks Dmitry i m  looking forward for ur answer

Re: Hijri date

Please download this project, run it and press button "Test print", let me know how to display date in report.


Thanks.

Post's attachments

Attachment icon TDateTime for report.zip 5.77 kb, 787 downloads since 2015-11-24 

Dmitry.

Re: Hijri date

i did Dmitry when i press test print still showin Gregorian date same as before

Re: Hijri date

Can you test it?
just run exe file and click button.

Post's attachments

Attachment icon Project1.zip 821.52 kb, 835 downloads since 2015-11-25 

Dmitry.

Re: Hijri date

i tried it still showing Gregorian date Dmitry.

Thanks for ur help

9 (edited by abouyahya527911 2015-11-27 05:07:28)

Re: Hijri date

Dmitry if that hard to fix this  what about Hijri Date Conversion Unit i found source code for delphi  in in this link http://delphidanlainnya.blogspot.com/20 … hi_23.html  if just i use Gregorian date for selecting and the date converted in the report to print what do you think is good idea or not  and it can be done?

Thanks

Re: Hijri date

I added this script to report.
Please download an example:

Post's attachments

Attachment icon TDateTime to Arabic date for report.zip 7.55 kb, 771 downloads since 2015-12-03 

Dmitry.

Re: Hijri date

DriveSoft wrote:

I added this script to report.
Please download an example:

i did download it but is not working for some how did u try it ? the date dont even change when print

Re: Hijri date

I checked again, works for me.

Dmitry.

Re: Hijri date

DriveSoft wrote:

I checked again, works for me.

try to select different date and press print its the same date as the first time

Re: Hijri date

abouyahya527911 wrote:
DriveSoft wrote:

I checked again, works for me.

try to select different date and press print its the same date as the first time

Thanks, I have made small change, please download the example again.

Dmitry.

15 (edited by abouyahya527911 2015-12-08 06:50:14)

Re: Hijri date

function Floor(const X: Single): Integer;
begin
  Result := Trunc(X);
  if Frac(X) < 0 then
    Dec(Result);
end;
  
function Ceil(const X: Single): Integer;
begin
  Result := Trunc(X);
  if Frac(X) > 0 then
    Inc(Result);
end;
  
function IntPart(Num : real) : integer;
begin 
  if Num < -0.0000001 then 
     Result := Ceil(Num - 0.0000001) 
  else 
  Result := Floor(Num + 0.0000001); 
end; 

 

function Gre2Hijri(var D, M, Y : word): string; 
var 
jd, l, n, j : integer; 
begin 
  if ((Y > 1582) or ((Y = 582) and (M > 10)) or ((Y = 1582) and (M = 10) and (D>14))) then 
  begin 
    jd := IntPart((1461 * (Y + 4800 + IntPart((M - 14)/12)))/4) + IntPart((367 * (M - 2 - 12 * (IntPart((M - 14)/12))))/12) - IntPart((3 * (IntPart((Y + 4900 + IntPart((M - 14)/12))/100)))/4) + D - 32075; 
  end 
  else 
  begin 
    jd := 367 * Y - IntPart((7 * (Y + 5001 + IntPart((M - 9)/7)))/4) + IntPart((275 * M)/9) + D + 1729777; 
  end; 

  l := jd -1948440 + 10632; 
  n := IntPart((l - 1)/10631); 
  l := l - 10631 * n + 354; 

  j := (IntPart((10985 - l)/5316)) * (IntPart((50 * l)/17719)) + (IntPart(l/5670)) * (IntPart((43 * l)/15238)); 

  l := l - (IntPart((30 - j)/15)) * (IntPart((17719 * j)/50)) - (IntPart(j/16)) * (IntPart((15238 * j)/43)) + 29; 

  m := IntPart((24 * l)/709); 
  d := l - IntPart((709 * m)/24); 
  y := 30 * n + j - 30; 

  Result := IntToStr(d)+'/'+IntToStr(m)+'/'+IntToStr(y);                                                                                                                        
end;   

procedure lbDateOnAfterData(Sender: TfrxComponent);
var
       D, M, Y: word;
       dt: TDateTime;                                      
begin
       if ValidFloat(TfrxMemoView(Sender).Value) then
       begin                   
               dt := StrToFloat(lbDate.Value);                                                       
               DecodeDate(dt, Y, M, D);
               TfrxMemoView(Sender).Text := Gre2Hijri(D, M,Y);                                      
       end;                 
end;

begin

end.

Dmitry what i can change to fix this issue what i select date for ex :  01 / 01 / 1437  and when i press print showin me : 30 / 12 / 1436       ???

Re: Hijri date

abouyahya527911
There is no precision method to convert Gregorian date to Hijri date. Sometime there is one day error.

Dmitry.

17 (edited by abouyahya527911 2015-12-08 11:51:39)

Re: Hijri date

DriveSoft wrote:

abouyahya527911
There is no precision method to convert Gregorian date to Hijri date. Sometime there is one day error.

i see Dmitry so can i make with group box method all was working fine for me onlt 2 problem i faced

1- if i use dates more then one time the calculated filed to show all in one cell it in table grid i mean in the second one to show it

2- search between dates with group box made instead normal dates any idea can i fix this 2 problem will do the job for me

Thanks

Re: Hijri date

abouyahya527911
Unfortunately I don't quite understand the questions, please attach your project with info, where are located these problems.

Dmitry.

Re: Hijri date

DriveSoft wrote:

abouyahya527911
Unfortunately I don't quite understand the questions, please attach your project with info, where are located these problems.

Dmitry  here is in example have look please


Attached without exe and dll

Post's attachments

Attachment icon Search date combo.rar 5.26 kb, 862 downloads since 2015-12-16 

Re: Hijri date

abouyahya527911 wrote:

Dmitry  here is in example have look please
Attached without exe and dll


Check out your project:

Post's attachments

Attachment icon Search date combo_fixed.zip 15.72 kb, 791 downloads since 2015-12-17 

Dmitry.

21 (edited by abouyahya527911 2015-12-17 08:47:47)

Re: Hijri date

Dmitry i tried it is not working well still making error and show other date that i want if u try diffrent month u will see by combo box is not possible ? sad(

Re: Hijri date

Please describe, what exactly don't work.
No need to use combobox for that.

Dmitry.