1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
   |  
var Params: IXMLCursor; 
    cDate, Date, result:string; 
    BDate: TDateTime; 
    NBdays, Days: array[1..7] of string; 
    DateNow :TDateTime; 
    Year, Month, Day: Word; 
    Jour, i, Week: Integer; 
begin 
  Date := DateToStr(Now); 
  DateTimeToString(cDate,'dd mmmm yyyy',Now); 
  Params:=OutputDoc.Select('/document'); 
  Params:=Params.AppendChild('Date',''); 
  Params.AppendChild('Date',(cDate)); 
  begin 
    Days[1] := '1';   //Sunday 
    Days[2] := '2';   //Monday 
    Days[3] := '3';   //Tuesday 
    Days[4] := '4';   //Wednesday 
    Days[5] := '5';   //Thursday 
    Days[6] := '6';   //Friday 
    Days[7] := '7';   //Saturday 
    BDate := StrToDate(Date); 
    Params.AppendChild ('DayOfWeek',Days[DayOfWeek(BDate)]); 
    begin 
      DateNow:= Now; 
      DecodeDate(DateNow, Year, Month, Day); 
      Params.AppendChild ('Day',IntToStr(Day)); 
      Params.AppendChild ('Month',IntToStr(Month)); 
      Params.AppendChild ('Year',IntToStr(Year)); 
    end; 
    begin 
      i:= DayOfWeek (BDate); 
      Jour := 1; 
      while Jour < Day do 
        begin 
          i := i; 
          i := i - 1; 
          Jour := Jour + 1 
        end; 
      Params:=OutputDoc.Select('/document'); 
      Params:=Params.AppendChild('CellS',''); 
      Params:=Params.AppendChild('Cell',''); 
      result:= ''; 
      i:= DayOfWeek (i); 
      Jour := 1; 
      Week := 1; 
      Month := 1; 
      Nbdays[1] := 'Sunday'; 
      Nbdays[2] := 'Monday'; 
      Nbdays[3] := 'Tuesday'; 
      Nbdays[4] := 'Wednesday'; 
      Nbdays[5] := 'Thursday'; 
      Nbdays[6] := 'Friday'; 
      Nbdays[7] := 'Saturday'; 
      Params:=OutputDoc.Select('/document/CellS/Cell'); 
      While Jour < 32 do 
      begin 
        result:= ''; 
        i := i; 
        Week := Week; 
        begin 
          if i = 2 then 
            begin 
              Week := Week + 1; 
              Params:=OutputDoc.Select('/document/CellS'); 
              Params:=Params.AppendChild('Cell',''); 
              Params:=Params.AppendChild('Week',''); 
             end; 
          if i = 7 then 
            begin 
              result:= Nbdays[i]; 
              i := 0; 
            end; 
          if i < 7 then 
            begin 
              Params:=Params.AppendChild('Week',''); 
              result:= result + Nbdays[i + 1]; 
              Params.AppendChild ('WeekOfMonth',IntToStr(Week)); 
              Params.AppendChild ('Days',Nbdays[DayOfWeek(i)]); 
              Params.AppendChild ('Day',IntToStr(Jour)); 
              Params.AppendChild ('Month',IntToStr(Month)); 
              Params.AppendChild ('Year',IntToStr(Year)); 
            end; 
          i := i + 1; 
          Jour := Jour + 1; 
        end; 
      end; 
    end; 
  end; 
end; | 
Partager