Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
procedure Page1OnManualBuild(Sender: TfrxComponent);

var    

  dsDishes : TfrxDataSet;

  i : integer;

  modstr, newmodstr : string;                                                                         

begin                    

  dsDishes:=MasterData1.DataSet;

  dsDishes.First;                                                           

  while not dsDishes.eof do begin

    if dsDishes.Value('ComboDish') <> '' then

    begin

      dsDishes.next;

      continue;                          

    end;            

    if length(dsDishes.Value('ModifiersText')) >0 then

    begin

     modstr:=dsDishes.Value('ModifiersText');                                

     while pos(',',modstr)<>0 do

     begin

       newmodstr:='- '+copy(modstr,0,pos(',',modstr)-1)+#13;

       modstr:=copy(modstr,pos(',',modstr)+1,length(modstr));                      

     end;

     newmodstr:=newmodstr+'- '+modstr;                                                                             

    end;             

    for i:=1 to dsDishes.Value('Quantity') do begin

      Memo10.Text:=newmodstr;                                          

      Engine.ShowBand(MasterData1);        

    end;

    newmodstr:='';                                          

    dsDishes.Next;                  

  end;


end;


begin


end.

Fastreport Script for Merging Vertical Cells

Mission: It is required to Task: To add the Order Contents field to the Operations cube. Upon creating a new cube column , columns display information incorrectly: if there are several deleted dishes in the same receipt, the Receipt Contents column duplicates the information.

Solution: change Change the script

Code Block
var prevOrder,     prevOrder3, prevShiftDate, prevDishName: string;

...



    DS, DS3: TfrxDataSet;  

...




procedure RKeeperDataOnBeforePrint(Sender: TfrxComponent);

...



begin

...



  prevOrder := '';

...



  prevOrder3 := '';    

...



  prevShiftDate := ''; 

...



  prevDishName := '';

...



end;

...




procedure Table_BodyOnAfterCalcHeight(Sender: TfrxComponent);

...



begin

...



 if ((Engine.FreeSpace < 2*memDataORDERNAME.Height) and (Engine.FreeSpace > memDataORDERNAME.Height))

...



  then memDataORDERNAME.Frame.Typ := memDataORDERNAME.Frame.Typ + ftBottom; }  

...



end;

...




procedure memDataSHIFTDATEOnBeforePrint(Sender: TfrxComponent);

...



begin

...



  if prevShiftDate = DateToStr(DS.value('SHIFTDATE'))

...



   then memDataSHIFTDATE.Frame.Typ := ftLeft + ftRight

...



   else memDataSHIFTDATE.Frame.Typ := ftLeft + ftRight + ftTop;

...



  DS.Next;

...



  if DS.Eof

...



   then memDataSHIFTDATE.Frame.Typ := memDataSHIFTDATE.Frame.Typ + ftBottom

...



   else DS.Prior;

...



  if null<>DS.value('SHIFTDATE') then     

...



    prevShiftDate := DateToStr(DS.value('SHIFTDATE'))

...



  else

...



    prevShiftDate := '';

...



end;

...




procedure memDataORDERNAMEOnBeforePrint(Sender: TfrxComponent);

...



begin

...



  if prevOrder = (DS.value('ORDERNAME'))

...



   then memDataORDERNAME.Frame.Typ := ftLeft + ftRight

...



   else memDataORDERNAME.Frame.Typ := ftLeft + ftRight + ftTop;

...



  DS.Next;

...



  if DS.Eof

...



   then memDataORDERNAME.Frame.Typ := memDataORDERNAME.Frame.Typ + ftBottom

...



   else DS.Prior;

...



  if null<>DS.value('ORDERNAME') then                          

...



    prevOrder := (DS.value('ORDERNAME'))

...



  else

...



    prevOrder := '';

...



end;

...




procedure memDataDISH1OnBeforePrint(Sender: TfrxComponent);

...



begin

...



  if (prevDishName = (DS3.value('DISH1')))and(prevOrder3 = (DS3.value('ORDERNAME')))            

...



   then memDataDISH1.Frame.Typ := ftLeft + ftRight

...



   else memDataDISH1.Frame.Typ := ftLeft + ftRight + ftTop;

...



  DS3.Next;

...



  if DS3.Eof

...



   then memDataDISH1.Frame.Typ := memDataDISH1.Frame.Typ + ftBottom

...



   else DS3.Prior;

...



  if null<>DS3.value('DISH1') then                           

...



    prevDishName := (DS3.value('DISH1'))

...



  else

...



    prevDishName := '';

...



  if null<>DS3.value('ORDERNAME') then                          

...



    prevOrder3 := (DS3.value('ORDERNAME'))

...



  else

...



    prevOrder3 := '';          

...



end;

...




begin

  DS := Table_Body.Dataset; // Report.GetDataSet('ReportSource');                                                                 

...



  DS3 := Table_Body.Dataset; // Report.GetDataSet('ReportSource');                                                                  

...



  prevOrder := '';

...



  prevOrder3 := '';

...



  prevShiftDate := '';

...



  prevDishName := '';    

...



end.

...

 Code Examples  Scripts in MCR Algorithms

...