Ignore:
Timestamp:
Jul 6, 2008, 8:20:14 PM (16 years ago)
Author:
Kevin Toppenberg
Message:

Uploading from OR_30_258

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/branches/foia-cprs/CPRS-Chart/Orders/fODDietLT.pas

    r459 r460  
    7575  begin
    7676    TimePart := Frac(x);
    77     if TimePart > 0.12 then
     77    if TimePart > 0.1159 then
    7878    begin
    79       x := x - 0.12;
     79      if TimePart > 0.1259 then x := x - 0.12;
    8080      Suffix := 'P'
    8181    end
     
    127127       (TimePart < (StrToIntDef(Piece(DietParams.Alarms, U, 6), 0) / 10000)) then Meal := 'E';
    128128    if Meal = #0 then Exit;
    129     // get the available late times for this meal
    130     case Meal of
    131     'B': AvailTimes := Pieces(DietParams.BTimes, U, 4, 6);
    132     'E': AvailTimes := Pieces(DietParams.ETimes, U, 4, 6);
    133     'N': AvailTimes := Pieces(DietParams.NTimes, U, 4, 6);
    134     end;
    135     SetAvailTimes(TimePart, TimeCount, AvailTimes);
    136     if TimeCount = 0 then Exit;
    137129  end
    138130  else  // for outpatients
    139131  begin
     132(*  From Rich Knoepfle, NFS developer
     133If they order a breakfast and it is after the LATE BREAKFAST ALARM END, I don't allow them to do it.  (For special meals I don't allow them to order something for the following day).
     134If it's before the LATE BREAKFAST ALARM BEGIN than I accept the order.
     135If it's between the LATE BREAKFAST ALARM BEGIN and ALARM END then I ask if they want to order a Late breakfast tray.
     136*)
    140137    Meal := AMeal;
    141138    case AMeal of
    142       'B':  if TimePart < (StrToIntDef(Piece(DietParams.Alarms, U, 1), 0) / 10000) then Meal := #0;
    143       'N':  if TimePart < (StrToIntDef(Piece(DietParams.Alarms, U, 3), 0) / 10000) then Meal := #0;
    144       'E':  if TimePart < (StrToIntDef(Piece(DietParams.Alarms, U, 5), 0) / 10000) then Meal := #0;
     139      'B':  if (TimePart < (StrToIntDef(Piece(DietParams.Alarms, U, 1), 0) / 10000)) or
     140               (TimePart > (StrToIntDef(Piece(DietParams.Alarms, U, 2), 0) / 10000)) then Meal := #0;
     141      'N':  if (TimePart < (StrToIntDef(Piece(DietParams.Alarms, U, 3), 0) / 10000)) or
     142               (TimePart > (StrToIntDef(Piece(DietParams.Alarms, U, 4), 0) / 10000)) then Meal := #0;
     143      'E':  if (TimePart < (StrToIntDef(Piece(DietParams.Alarms, U, 5), 0) / 10000)) or
     144               (TimePart > (StrToIntDef(Piece(DietParams.Alarms, U, 6), 0) / 10000)) then Meal := #0;
    145145    end;
    146146    if Meal = #0 then exit;
    147147  end;
     148
     149  // get the available late times for this meal
     150  case Meal of
     151  'B': AvailTimes := Pieces(DietParams.BTimes, U, 4, 6);
     152  'E': AvailTimes := Pieces(DietParams.ETimes, U, 4, 6);
     153  'N': AvailTimes := Pieces(DietParams.NTimes, U, 4, 6);
     154  end;
     155  SetAvailTimes(TimePart, TimeCount, AvailTimes);
     156  if TimeCount = 0 then Exit;
     157
    148158  // setup form to get the selected late tray
    149159  frmODDietLT := TfrmODDietLT.Create(Application);
     
    153163    begin
    154164      FOutpatient := IsOutpatient;
    155       if not IsOutpatient then
    156       begin
    157         if Length(Piece(AvailTimes, U, 1)) > 0 then radLT1.Caption := Piece(AvailTimes, U, 1);
    158         if Length(Piece(AvailTimes, U, 2)) > 0 then radLT2.Caption := Piece(AvailTimes, U, 2);
    159         if Length(Piece(AvailTimes, U, 3)) > 0 then radLT3.Caption := Piece(AvailTimes, U, 3);
    160         radLT1.Visible := Length(radLT1.Caption) > 0;
    161         radLT2.Visible := Length(radLT2.Caption) > 0;
    162         radLT3.Visible := Length(radLT3.Caption) > 0;
    163         radLT1.Checked := TimeCount = 1;
    164       end
    165       else GroupBox1.Visible := False;
     165      if Length(Piece(AvailTimes, U, 1)) > 0 then radLT1.Caption := Piece(AvailTimes, U, 1);
     166      if Length(Piece(AvailTimes, U, 2)) > 0 then radLT2.Caption := Piece(AvailTimes, U, 2);
     167      if Length(Piece(AvailTimes, U, 3)) > 0 then radLT3.Caption := Piece(AvailTimes, U, 3);
     168      radLT1.Visible := Length(radLT1.Caption) > 0;
     169      radLT2.Visible := Length(radLT2.Caption) > 0;
     170      radLT3.Visible := Length(radLT3.Caption) > 0;
     171      radLT1.Checked := TimeCount = 1;
    166172      chkBagged.Visible := DietParams.Bagged;
    167173      with lblMealCutOff do case Meal of
     
    174180      if YesPressed then
    175181      begin
    176         if not IsOutpatient then
    177         begin
    178           with radLT1 do if Checked then LateTrayFields.LateTime := Caption;
    179           with radLT2 do if Checked then LateTrayFields.LateTime := Caption;
    180           with radLT3 do if Checked then LateTrayFields.LateTime := Caption;
    181         end
    182         else
    183           LateTrayFields.LateTime := FMTimeToAMPM(FMToday + TimePart);
     182        with radLT1 do if Checked then LateTrayFields.LateTime := Caption;
     183        with radLT2 do if Checked then LateTrayFields.LateTime := Caption;
     184        with radLT3 do if Checked then LateTrayFields.LateTime := Caption;
    184185        LateTrayFields.LateMeal := Meal;
    185186        LateTrayFields.IsBagged := chkBagged.Checked;
    186       end; {if YesPressed}
     187      end;
    187188    end; {with frmODDietLT}
    188189  finally
Note: See TracChangeset for help on using the changeset viewer.