[456] | 1 | unit uSignItems;
|
---|
| 2 |
|
---|
| 3 | {.$define debug}
|
---|
| 4 |
|
---|
| 5 | interface
|
---|
| 6 |
|
---|
| 7 | uses
|
---|
| 8 | SysUtils, Windows, Classes, Graphics, Controls, StdCtrls, CheckLst, ORClasses, ORCtrls,
|
---|
| 9 | Dialogs, UBAConst, fODBase, UBACore, Forms;
|
---|
| 10 |
|
---|
| 11 | type
|
---|
| 12 | TSigItemType = (siServiceConnected, siAgentOrange, siIonizingRadiation,
|
---|
| 13 | siEnvironmentalContaminants, siMST, siHeadNeckCancer, siCombatVeteran);
|
---|
| 14 |
|
---|
| 15 | TSigItemTagInfo = record
|
---|
| 16 | SigType: TSigItemType;
|
---|
| 17 | Index: integer;
|
---|
| 18 | end;
|
---|
| 19 |
|
---|
| 20 | TSigItems = class(TComponent)
|
---|
| 21 | private
|
---|
| 22 | FBuilding: boolean;
|
---|
| 23 | FStsCount: integer;
|
---|
| 24 | FItems: TORStringList;
|
---|
| 25 | FOldDrawItemEvent: TDrawItemEvent;
|
---|
| 26 | Fcb: TList;
|
---|
| 27 | Flb: TCustomListBox;
|
---|
| 28 | FLastValidX: integer;
|
---|
| 29 | FValidGap: integer;
|
---|
| 30 | FDy: integer;
|
---|
| 31 | FAllCheck: array[TSigItemType] of boolean;
|
---|
| 32 | FAllCatCheck: boolean;
|
---|
| 33 | FcbX: array[TSigItemType] of integer;
|
---|
| 34 | function TagInfo(ASigType: TSigItemType; AIndex: integer): TSigItemTagInfo;
|
---|
| 35 | //function ItemToTag(Info: TSigItemTagInfo): integer;
|
---|
| 36 | //function TagToItem(ATag: integer): TSigItemTagInfo;
|
---|
| 37 | procedure cbClicked(Sender: TObject);
|
---|
| 38 | procedure cbEnter(Sender: TObject);
|
---|
| 39 | procedure cbExit(Sender: TObject);
|
---|
| 40 | procedure lbDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
|
---|
| 41 | procedure CopyCBValues(FromIndex, ToIndex: integer);
|
---|
| 42 | function FindCBValues(ATag: integer): TORCheckBox;
|
---|
| 43 | function GetTempCkBxState(Index: integer; CBValue:TSigItemType): string;
|
---|
| 44 |
|
---|
| 45 | protected
|
---|
| 46 | procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
---|
| 47 | public
|
---|
| 48 | constructor Create(AOwner: TComponent); override;
|
---|
| 49 | destructor Destroy; override;
|
---|
| 50 | procedure Add(ItemType: Integer; const ID: string; Index: integer);
|
---|
| 51 | procedure Remove(ItemType: integer; const ID: string);
|
---|
| 52 | procedure ResetOrders;
|
---|
| 53 | procedure Clear;
|
---|
| 54 | function UpdateListBox(lb: TCustomListBox): boolean;
|
---|
| 55 | procedure EnableSettings(Index: integer; Checked: boolean);
|
---|
| 56 | function OK2SaveSettings: boolean;
|
---|
| 57 | procedure SaveSettings;
|
---|
| 58 | procedure DisplayPlTreatmentFactors;
|
---|
| 59 | procedure DisplayUnsignedStsFlags(sFlags:string);
|
---|
| 60 | function GetSigItems : TORStringList; //BAPHII 1.3.1
|
---|
| 61 | function FindCB(ATag: integer): TORCheckBox; //BAPHII 1.3.1
|
---|
| 62 | procedure CopyCB(FromIndex, ToIndex: integer); //BAPHII 1.3.1
|
---|
| 63 | procedure SetSigItems(Sender: TObject; sourceOrderID: string); //BAPHII 1.3.1
|
---|
| 64 | //procedure SetSigItems(Sender: TObject; itemsList: TStringList; sourceOrderID: string); //BAPHII 1.3.1
|
---|
| 65 | function ItemToTag(Info: TSigItemTagInfo): integer; //CQ5074
|
---|
| 66 | function TagToItem(ATag: integer): TSigItemTagInfo; //CQ5074
|
---|
| 67 | end;
|
---|
| 68 |
|
---|
| 69 | function SigItems: TSigItems;
|
---|
| 70 | function SigItemHeight: integer;
|
---|
| 71 |
|
---|
| 72 | const
|
---|
| 73 |
|
---|
| 74 | TC_Order_Error = 'All Service Connection and/or Rated Disabilities questions must be answered.';
|
---|
| 75 |
|
---|
| 76 |
|
---|
| 77 | TX_Order_Error = 'All Service Connection and/or Rated Disabilities questions must be answered, '+#13+
|
---|
| 78 | 'and at least one diagnosis selected for each order that requires a diagnosis.';
|
---|
| 79 |
|
---|
| 80 | TC_Diagnosis_Error = ' Missing Diagnosis';
|
---|
| 81 | TX_Diagnosis_Error = ' One or more Orders have not been assigned a Diagnosis';
|
---|
| 82 | INIT_STR = '';
|
---|
| 83 |
|
---|
| 84 |
|
---|
| 85 | var
|
---|
| 86 | uSigItems: TSigItems = nil; //BAPHII 1.3.1
|
---|
| 87 |
|
---|
| 88 | implementation
|
---|
| 89 |
|
---|
| 90 | uses
|
---|
| 91 | ORFn, ORNet, uConst, TRPCB, rOrders, rPCE, fOrdersSign, fReview,UBAGlobals,
|
---|
| 92 | uCore ;
|
---|
| 93 |
|
---|
| 94 | type
|
---|
| 95 | ItemStatus = (isNA, isChecked, isUnchecked, isUnknown);
|
---|
| 96 | SigDescType = (sdShort, sdLong);
|
---|
| 97 |
|
---|
| 98 | const
|
---|
| 99 | SigItemDesc: array[TSigItemType, SigDescType] of string =
|
---|
| 100 | { siServiceConnected } (('SC', 'Service Connected Condition'),
|
---|
| 101 | { siAgentOrange } ('AO', 'Agent Orange Exposure'),
|
---|
| 102 | { siIonizingRadiation } ('IR', 'Ionizing Radiation Exposure'),
|
---|
| 103 | { siEnvironmentalContaminants } ('EC', 'Environmental Contaminants'),
|
---|
| 104 | { siMST } ('MST', 'MST'), //'Military Sexual Trauma'
|
---|
| 105 | { siHeadNeckCancer } ('HNC', 'Head and/or Neck Cancer'),
|
---|
| 106 | { siCombatVeteran } ('CV', 'Combat Veteran Related'));
|
---|
| 107 |
|
---|
| 108 | SigItemDisplayOrder: array[TSigItemType] of TSigItemType =
|
---|
| 109 | ( siServiceConnected,
|
---|
| 110 | siCombatVeteran,
|
---|
| 111 | siAgentOrange,
|
---|
| 112 | siIonizingRadiation,
|
---|
| 113 | siEnvironmentalContaminants,
|
---|
| 114 | siMST,
|
---|
| 115 | siHeadNeckCancer );
|
---|
| 116 |
|
---|
| 117 | StsChar: array[ItemStatus] of char =
|
---|
| 118 | { isNA } ('N',
|
---|
| 119 | { isChecked } 'C',
|
---|
| 120 | { isUnchecked } 'U',
|
---|
| 121 | { isUnknown } '?');
|
---|
| 122 |
|
---|
| 123 | ColIdx = 30000;
|
---|
| 124 | AllIdx = 31000;
|
---|
| 125 | NA_FLAGS = 'NNNNNNN';
|
---|
| 126 |
|
---|
| 127 | var
|
---|
| 128 | uSingletonFlag: boolean = FALSE;
|
---|
| 129 | FlagCount: integer;
|
---|
| 130 | BaseFlags: string;
|
---|
| 131 | tempCkBx: TORCheckBox;
|
---|
| 132 | thisOrderID: string;
|
---|
| 133 | thisChangeItem: TChangeItem;
|
---|
| 134 |
|
---|
| 135 |
|
---|
| 136 | function TSigItems.GetSigItems : TORStringList;
|
---|
| 137 | begin
|
---|
| 138 | Result := FItems;
|
---|
| 139 | end;
|
---|
| 140 |
|
---|
| 141 | function TSigItems.FindCB(ATag: integer): TORCheckBox;
|
---|
| 142 | var
|
---|
| 143 | i: integer;
|
---|
| 144 | wc: TWinControl;
|
---|
| 145 | begin
|
---|
| 146 | for i := 0 to Fcb.Count-1 do
|
---|
| 147 | begin
|
---|
| 148 | wc := TWinControl(Fcb[i]);
|
---|
| 149 | if(wc is TORCheckBox) and (wc.Tag = ATag) then
|
---|
| 150 | begin
|
---|
| 151 | Result := TORCheckBox(wc);
|
---|
| 152 | exit;
|
---|
| 153 | end;
|
---|
| 154 | end;
|
---|
| 155 | Result := nil;
|
---|
| 156 | end;
|
---|
| 157 |
|
---|
| 158 | procedure TSigItems.CopyCB(FromIndex, ToIndex: integer);
|
---|
| 159 | var
|
---|
| 160 | si: TSigItemType;
|
---|
| 161 | FromTag, ToTag: integer;
|
---|
| 162 | FromCB, ToCB: TORCheckBox;
|
---|
| 163 |
|
---|
| 164 | begin
|
---|
| 165 | for si := low(TSigItemType) to high(TSigItemType) do
|
---|
| 166 | begin
|
---|
| 167 | FromTag := ItemToTag(TagInfo(si, FromIndex));
|
---|
| 168 | ToTag := ItemToTag(TagInfo(si, ToIndex));
|
---|
| 169 | FromCB := FindCB(FromTag);
|
---|
| 170 | ToCB := FindCB(ToTag);
|
---|
| 171 | if(Assigned(FromCB) and Assigned(ToCB)) then
|
---|
| 172 | ToCB.State := FromCB.State;
|
---|
| 173 | end;
|
---|
| 174 | end;
|
---|
| 175 |
|
---|
| 176 | procedure TSigItems.SetSigItems(Sender: TObject; sourceOrderID: string);
|
---|
| 177 | {
|
---|
| 178 | BAPHII 1.3.1
|
---|
| 179 | }
|
---|
| 180 | var
|
---|
| 181 | i: integer;
|
---|
| 182 | begin
|
---|
| 183 | if (Sender as TCaptionCheckListBox).Name = 'clstOrders' then
|
---|
| 184 | for i := 0 to frmSignOrders.clstOrders.Count - 1 do
|
---|
| 185 | begin
|
---|
| 186 | if ((fOrdersSign.frmSignOrders.clstOrders.Selected[i]) and (fOrdersSign.targetOrderID <> fOrdersSign.srcOrderID)) then
|
---|
| 187 | CopyCB(fOrdersSign.srcIndex, i);
|
---|
| 188 | end
|
---|
| 189 | else
|
---|
| 190 | if (Sender as TCaptionCheckListBox).Name = 'lstReview' then
|
---|
| 191 | for i := 1 to frmReview.lstReview.Count -1 do
|
---|
| 192 | begin
|
---|
| 193 | if ((fReview.frmReview.lstReview.Selected[i]) and (fReview.targetOrderID <> fReview.srcOrderID)) then
|
---|
| 194 | CopyCB(fReview.srcIndex, i);
|
---|
| 195 | end;
|
---|
| 196 | end;
|
---|
| 197 |
|
---|
| 198 | function SigItems: TSigItems;
|
---|
| 199 | begin
|
---|
| 200 | if not assigned(uSigItems) then
|
---|
| 201 | begin
|
---|
| 202 | uSingletonFlag := TRUE;
|
---|
| 203 | try
|
---|
| 204 | uSigItems := TSigItems.Create(nil);
|
---|
| 205 | finally
|
---|
| 206 | uSingletonFlag := FALSE;
|
---|
| 207 | end;
|
---|
| 208 | end;
|
---|
| 209 | Result := uSigItems;
|
---|
| 210 | end;
|
---|
| 211 |
|
---|
| 212 | function SigItemHeight: integer;
|
---|
| 213 | begin
|
---|
| 214 | Result := MainFontHeight + 2;
|
---|
| 215 | end;
|
---|
| 216 |
|
---|
| 217 | { TSigItems }
|
---|
| 218 | {
|
---|
| 219 | FItems Layout:
|
---|
| 220 | 1 2 3 4 5
|
---|
| 221 | OrderID ^ ListBox Index ^ RPC Call was Made (0 or 1) ^ Settings by char pos ^ Disabled Flag
|
---|
| 222 | }
|
---|
| 223 |
|
---|
| 224 | procedure TSigItems.Add(ItemType: Integer; const ID: string; Index: integer);
|
---|
| 225 | var
|
---|
| 226 | idx: integer;
|
---|
| 227 | begin
|
---|
| 228 | if ItemType = CH_ORD then
|
---|
| 229 | begin
|
---|
| 230 | idx := FItems.IndexOfPiece(ID);
|
---|
| 231 | if idx < 0 then
|
---|
| 232 | idx := FItems.Add(ID);
|
---|
| 233 | FItems.SetStrPiece(idx, 2, IntToStr(Index));
|
---|
| 234 | FItems.SetStrPiece(idx,5,INIT_STR); // hds4807 value was being reatained when same order selected in FReview.
|
---|
| 235 |
|
---|
| 236 | end;
|
---|
| 237 | end;
|
---|
| 238 |
|
---|
| 239 | procedure TSigItems.Clear;
|
---|
| 240 | begin
|
---|
| 241 | FItems.Clear;
|
---|
| 242 | Fcb.Clear;
|
---|
| 243 | end;
|
---|
| 244 |
|
---|
| 245 | constructor TSigItems.Create(AOwner: TComponent);
|
---|
| 246 | begin
|
---|
| 247 | if not uSingletonFlag then
|
---|
| 248 | raise Exception.Create('Only one instance of TSigItems allowed');
|
---|
| 249 | inherited Create(AOwner);
|
---|
| 250 | FItems := TORStringList.Create;
|
---|
| 251 | Fcb := TList.Create;
|
---|
| 252 | tempCkBx := TORCheckBox.Create(Owner);
|
---|
| 253 |
|
---|
| 254 | end;
|
---|
| 255 |
|
---|
| 256 | destructor TSigItems.Destroy;
|
---|
| 257 | begin
|
---|
| 258 | FreeAndNil(FItems);
|
---|
| 259 | FreeAndNil(Fcb);
|
---|
| 260 | inherited;
|
---|
| 261 | end;
|
---|
| 262 |
|
---|
| 263 | procedure TSigItems.Remove(ItemType: integer; const ID: string);
|
---|
| 264 | var
|
---|
| 265 | idx: integer;
|
---|
| 266 |
|
---|
| 267 | begin
|
---|
| 268 | if ItemType = CH_ORD then
|
---|
| 269 | begin
|
---|
| 270 | idx := FItems.IndexOfPiece(ID);
|
---|
| 271 | if idx >= 0 then
|
---|
| 272 | FItems.Delete(idx);
|
---|
| 273 | end;
|
---|
| 274 | end;
|
---|
| 275 |
|
---|
| 276 | procedure TSigItems.ResetOrders; // Resets ListBox positions, to avoid old data messing things up
|
---|
| 277 | var
|
---|
| 278 | i: integer;
|
---|
| 279 |
|
---|
| 280 | begin
|
---|
| 281 | for i := 0 to FItems.Count-1 do
|
---|
| 282 | FItems.SetStrPiece(i, 2, '-1');
|
---|
| 283 | end;
|
---|
| 284 |
|
---|
| 285 | function TSigItems.ItemToTag(Info: TSigItemTagInfo): integer;
|
---|
| 286 | begin
|
---|
| 287 | if Info.Index < 0 then
|
---|
| 288 | Result := 0
|
---|
| 289 | else
|
---|
| 290 | Result := (Info.Index*FlagCount) + ord(Info.SigType) + 1;
|
---|
| 291 | end;
|
---|
| 292 |
|
---|
| 293 |
|
---|
| 294 | function TSigItems.TagInfo(ASigType: TSigItemType; AIndex: integer): TSigItemTagInfo;
|
---|
| 295 | begin
|
---|
| 296 | Result.SigType := ASigType;
|
---|
| 297 | Result.Index := AIndex;
|
---|
| 298 | end;
|
---|
| 299 |
|
---|
| 300 | function TSigItems.TagToItem(ATag: integer): TSigItemTagInfo;
|
---|
| 301 | begin
|
---|
| 302 | if ATag <= 0 then
|
---|
| 303 | begin
|
---|
| 304 | Result.Index := -1;
|
---|
| 305 | Result.SigType := TSigItemType(0);
|
---|
| 306 | end
|
---|
| 307 | else
|
---|
| 308 | begin
|
---|
| 309 | dec(ATag);
|
---|
| 310 | Result.SigType := TSigItemType(ATag mod FlagCount);
|
---|
| 311 | Result.Index := ATag div FlagCount;
|
---|
| 312 | end;
|
---|
| 313 | end;
|
---|
| 314 |
|
---|
| 315 | type
|
---|
| 316 | TExposedListBox = class(TCustomListBox)
|
---|
| 317 | public
|
---|
| 318 | property OnDrawItem;
|
---|
| 319 | end;
|
---|
| 320 |
|
---|
| 321 | function TSigItems.UpdateListBox(lb: TCustomListBox): boolean;
|
---|
| 322 | const
|
---|
| 323 | cbWidth = 13;
|
---|
| 324 | cbHeight = 13;
|
---|
| 325 | btnGap = 2;
|
---|
| 326 | AllTxt = 'All';
|
---|
| 327 |
|
---|
| 328 | var
|
---|
| 329 | cb: TORCheckBox;
|
---|
| 330 | btn: TButton;
|
---|
| 331 | lbl: TLabel;
|
---|
| 332 | prnt: TWinControl;
|
---|
| 333 | ownr: TComponent;
|
---|
| 334 | FirstValidItem: TSigItemType;
|
---|
| 335 | x, y, MaxX, i, btnW, btnH, j, dx, ht, idx, dgrp: integer;
|
---|
| 336 | s, id, Code, cType, Flags: string;
|
---|
| 337 | StsCode: char;
|
---|
| 338 | sx, si: TSigItemType;
|
---|
| 339 | sts, StsIdx: ItemStatus;
|
---|
| 340 | StsUsed: array[TSigItemType] of boolean;
|
---|
| 341 | AResponses : TResponses;
|
---|
| 342 | UFlags: string;
|
---|
| 343 | thisCB: TORCheckBox;
|
---|
| 344 | cpFlags: string;
|
---|
| 345 |
|
---|
| 346 |
|
---|
| 347 | itemText: string;
|
---|
| 348 | thisTagInfo: TSigItemTagInfo;
|
---|
| 349 |
|
---|
| 350 | function CreateCB(AParent: TWinControl): TORCheckBox;
|
---|
| 351 | begin
|
---|
| 352 | Result := TORCheckBox.Create(ownr);
|
---|
| 353 | Result.Parent := AParent;
|
---|
| 354 | Result.Height := cbHeight;
|
---|
| 355 | Result.Width := cbWidth;
|
---|
| 356 | Result.GrayedStyle := gsBlueQuestionMark;
|
---|
| 357 | Result.GrayedToChecked := FALSE;
|
---|
| 358 | Result.OnClick := cbClicked;
|
---|
| 359 | Result.OnEnter := cbEnter;
|
---|
| 360 | Result.OnExit := cbExit;
|
---|
| 361 | Fcb.Add(Result);
|
---|
| 362 | end;
|
---|
| 363 |
|
---|
| 364 | begin
|
---|
| 365 | Result := FALSE;
|
---|
| 366 | Fcb.Clear;
|
---|
| 367 | FBuilding := TRUE;
|
---|
| 368 | try
|
---|
| 369 |
|
---|
| 370 | try
|
---|
| 371 | idx := 0;
|
---|
| 372 | RPCBrokerV.ClearParameters := True;
|
---|
| 373 |
|
---|
| 374 | for i := 0 to FItems.Count-1 do
|
---|
| 375 | begin
|
---|
| 376 | s := FItems[i];
|
---|
| 377 | thisOrderID := Piece(s,U,1);
|
---|
| 378 | if BILLING_AWARE then
|
---|
| 379 | if NOT UBACore.IsOrderBillable(thisOrderID) then
|
---|
| 380 | RemoveOrderFromDxList(thisOrderID);
|
---|
| 381 | if (piece(s, U, 2) <> '-1') and (piece(s, U, 3) <> '1') then
|
---|
| 382 | begin
|
---|
| 383 | with RPCBrokerV do
|
---|
| 384 | begin
|
---|
| 385 | if idx = 0 then
|
---|
| 386 | Param[1].PType := list;
|
---|
| 387 | inc(idx);
|
---|
| 388 | Param[1].Mult[IntToStr(idx)] := piece(s, U, 1);
|
---|
| 389 | end;
|
---|
| 390 | end;
|
---|
| 391 | end; //for
|
---|
| 392 |
|
---|
| 393 | if idx > 0 then
|
---|
| 394 | begin
|
---|
| 395 | if BILLING_AWARE then
|
---|
| 396 | rpcGetSC4Orders // get SC/EIC information for all CIDC TYPE orders
|
---|
| 397 | else
|
---|
| 398 | GetCoPay4Orders; // enforces existing NON CIDC CO-PAY rules
|
---|
| 399 | for i := 0 to RPCBrokerV.Results.Count-1 do
|
---|
| 400 | begin
|
---|
| 401 | s := RPCBrokerV.Results[i];
|
---|
| 402 | {Begin BillingAware}
|
---|
| 403 | if BILLING_AWARE then
|
---|
| 404 | begin
|
---|
| 405 | if (CharAt(piece(s,';',2),1) <> '1') then
|
---|
| 406 | s := piece(s,U,1);
|
---|
| 407 | end;
|
---|
| 408 | id := piece(s,U,1);
|
---|
| 409 | idx := FItems.IndexOfPiece(id);
|
---|
| 410 |
|
---|
| 411 | if idx >= 0 then
|
---|
| 412 | begin
|
---|
| 413 | FItems.SetStrPiece(idx, 3, '1'); // Mark as read from RPC
|
---|
| 414 | j := 2;
|
---|
| 415 | Flags := BaseFlags;
|
---|
| 416 |
|
---|
| 417 | repeat
|
---|
| 418 | Code := piece(s,U,j);
|
---|
| 419 |
|
---|
| 420 | if Code <> '' then
|
---|
| 421 | begin
|
---|
| 422 | cType := piece(Code, ';', 1);
|
---|
| 423 |
|
---|
| 424 | for si := low(TSigItemType) to high(TSigItemType) do
|
---|
| 425 | begin
|
---|
| 426 | if cType = SigItemDesc[si, sdShort] then
|
---|
| 427 | begin
|
---|
| 428 | cType := piece(Code, ';', 2);
|
---|
| 429 |
|
---|
| 430 | if cType = '0' then
|
---|
| 431 | sts := isUnchecked
|
---|
| 432 | else
|
---|
| 433 | if cType = '1' then
|
---|
| 434 | sts := isChecked
|
---|
| 435 | else
|
---|
| 436 | sts := isUnknown;
|
---|
| 437 |
|
---|
| 438 | Flags[ord(si)+1] := StsChar[sts];
|
---|
| 439 | break;
|
---|
| 440 |
|
---|
| 441 | end; //if cType = SigItemDesc[si, sdShort]
|
---|
| 442 | end; //for
|
---|
| 443 | end; //if Code <> ''
|
---|
| 444 |
|
---|
| 445 | inc(j);
|
---|
| 446 | until(Code = '');
|
---|
| 447 |
|
---|
| 448 | FItems.SetStrPiece(idx, 4, Flags);
|
---|
| 449 | // new code if deleted order and ba on then
|
---|
| 450 | // reset appropriate tf flags to "?".
|
---|
| 451 |
|
---|
| 452 |
|
---|
| 453 | if BILLING_AWARE then
|
---|
| 454 | begin
|
---|
| 455 | if not UBACore.OrderRequiresSCEI(Piece(s,U,1)) then
|
---|
| 456 | FItems.SetStrPiece(idx,4, NA_FLAGS)
|
---|
| 457 | else
|
---|
| 458 | begin
|
---|
| 459 |
|
---|
| 460 | if UBAGlobals.BAUnsignedOrders.Count > 0 then
|
---|
| 461 | begin
|
---|
| 462 | UFlags := UBACore.GetUnsignedOrderFlags(Piece(s,U,1),UBAGlobals.BAUnsignedOrders);
|
---|
| 463 | if UFlags <> '' then FItems.SetStrPiece(idx,4, UFlags)
|
---|
| 464 | end;
|
---|
| 465 | //********************************
|
---|
| 466 | if UBAGlobals.BACopiedOrderFlags.Count > 0 then //BAPHII 1.3.2
|
---|
| 467 | begin
|
---|
| 468 | UFlags := UBACore.GetUnsignedOrderFlags(Piece(s,U,1),UBAGlobals.BACopiedOrderFlags); //BAPHII 1.3.2
|
---|
| 469 | if UFlags <> '' then //BAPHII 1.3.2
|
---|
| 470 | FItems.SetStrPiece(idx,4,UFlags); //BAPHII 1.3.2
|
---|
| 471 | end;
|
---|
| 472 | //********************************
|
---|
| 473 | if UBAGlobals.BAConsultPLFlags.Count > 0 then
|
---|
| 474 | begin
|
---|
| 475 | UFlags := GetConsultFlags(Piece(s,U,1),UBAGlobals.BAConsultPLFlags,Flags);
|
---|
| 476 |
|
---|
| 477 | if UFlags <> '' then
|
---|
| 478 | FItems.SetStrPiece(idx,4, UFlags);
|
---|
| 479 | end;
|
---|
| 480 |
|
---|
| 481 | UBAGlobals.BAFlagsIN := Flags;
|
---|
| 482 | end; //else
|
---|
| 483 | end; //if BILLING_AWARE
|
---|
| 484 |
|
---|
| 485 | end; //if idx >= 0
|
---|
| 486 |
|
---|
| 487 | end; //for i := 0 to RPCBrokerV.Results.Count-1
|
---|
| 488 | end; //if idx > 0
|
---|
| 489 |
|
---|
| 490 | FStsCount := 0;
|
---|
| 491 |
|
---|
| 492 | for si := low(TSigItemType) to high(TSigItemType) do
|
---|
| 493 | StsUsed[si] := FALSE;
|
---|
| 494 | // loop thru orders selected to be signed fReview/fOrdersSign.
|
---|
| 495 | for i := 0 to FItems.Count-1 do
|
---|
| 496 | begin
|
---|
| 497 | s := FItems[i];
|
---|
| 498 |
|
---|
| 499 | if (piece(s,u,2) <> '-1') and (piece(s,u,3) = '1') then
|
---|
| 500 | begin
|
---|
| 501 | s := piece(s, u, 4); // SC/EI
|
---|
| 502 | // code added 01/17/2006 - check dc'd nurse orders, originals where requiring CIDC if assigned to patient.
|
---|
| 503 | if (BILLING_AWARE) and (not UBACore.IsOrderBillable(Piece(s,U,1))) then
|
---|
| 504 | s := NA_FLAGS;
|
---|
| 505 |
|
---|
| 506 | for si := low(TSigItemType) to high(TSigItemType) do
|
---|
| 507 | if (not StsUsed[si]) and (s[ord(si)+1] <> StsChar[isNA]) then
|
---|
| 508 | begin
|
---|
| 509 | StsUsed[si] := TRUE;
|
---|
| 510 | inc(FStsCount);
|
---|
| 511 | if FStsCount >= FlagCount then break;
|
---|
| 512 | end;
|
---|
| 513 | end;
|
---|
| 514 |
|
---|
| 515 | if FStsCount >= FlagCount then
|
---|
| 516 | Break;
|
---|
| 517 | end; //for
|
---|
| 518 |
|
---|
| 519 | {Begin BillingAware}
|
---|
| 520 | if BILLING_AWARE then
|
---|
| 521 | begin
|
---|
| 522 | if FStsCount = 0 then // Billing Awareness. Force Grid to paint correctly
|
---|
| 523 | FStsCount := 1;
|
---|
| 524 | end;
|
---|
| 525 | {End BillingAware}
|
---|
| 526 |
|
---|
| 527 | if FStsCount > 0 then
|
---|
| 528 | begin
|
---|
| 529 | Result := TRUE;
|
---|
| 530 | FirstValidItem := TSigItemType(0);
|
---|
| 531 |
|
---|
| 532 | prnt := lb.Parent;
|
---|
| 533 | ownr := lb.Owner;
|
---|
| 534 | MaxX := lb.ClientWidth;
|
---|
| 535 | lb.Canvas.Font := MainFont;
|
---|
| 536 | btnW := 0;
|
---|
| 537 |
|
---|
| 538 | for si := low(TSigItemType) to high(TSigItemType) do
|
---|
| 539 | begin
|
---|
| 540 | j := lb.Canvas.TextWidth(SigItemDesc[si, sdShort]);
|
---|
| 541 | if btnW < j then
|
---|
| 542 | btnW := j;
|
---|
| 543 | end;
|
---|
| 544 |
|
---|
| 545 | inc(btnW, 8);
|
---|
| 546 | btnH := ResizeHeight( BaseFont, MainFont, 21);
|
---|
| 547 | x := MaxX;
|
---|
| 548 | dx := (btnW - cbWidth) div 2;
|
---|
| 549 |
|
---|
| 550 | for si := high(TSigItemType) downto low(TSigItemType) do
|
---|
| 551 | begin
|
---|
| 552 | FcbX[si] := x - btnW + dx;
|
---|
| 553 | dec(x, btnW + btnGap);
|
---|
| 554 | end;
|
---|
| 555 |
|
---|
| 556 | if FStsCount > 1 then
|
---|
| 557 | begin
|
---|
| 558 | FAllCatCheck := FALSE;
|
---|
| 559 | btn := TButton.Create(ownr);
|
---|
| 560 | btn.Parent := prnt;
|
---|
| 561 | btn.Height := btnH;
|
---|
| 562 | btn.Width := btnW;
|
---|
| 563 | btn.Caption := AllTxt;
|
---|
| 564 | btn.OnClick := cbClicked;
|
---|
| 565 | btn.Left := FcbX[TSigItemType(0)] + lb.Left - dx + 2 - (FcbX[TSigItemType(1)] - FcbX[TSigItemType(0)]);
|
---|
| 566 | btn.Top := lb.Top - btn.height - 2;
|
---|
| 567 | btn.Tag := AllIdx;
|
---|
| 568 | btn.ShowHint := TRUE;
|
---|
| 569 | btn.Hint := 'Set All Related Entries';
|
---|
| 570 | btn.TabOrder := lb.TabOrder;
|
---|
| 571 | Fcb.Add(btn);
|
---|
| 572 | end;
|
---|
| 573 |
|
---|
| 574 | for sx := low(TSigItemType) to high(TSigItemType) do
|
---|
| 575 | begin
|
---|
| 576 | si := SigItemDisplayOrder[sx];
|
---|
| 577 | FAllCheck[si] := TRUE;
|
---|
| 578 | btn := TButton.Create(ownr);
|
---|
| 579 | btn.Parent := prnt;
|
---|
| 580 | btn.Height := btnH;
|
---|
| 581 | btn.Width := btnW;
|
---|
| 582 | btn.Caption := SigItemDesc[si, sdShort];
|
---|
| 583 | btn.OnClick := cbClicked;
|
---|
| 584 | btn.Left := FcbX[sx] + lb.Left - dx + 2;
|
---|
| 585 | btn.Top := lb.Top - btn.height - 2;
|
---|
| 586 | btn.Tag := ColIdx + ord(si);
|
---|
| 587 | btn.ShowHint := TRUE;
|
---|
| 588 | btn.Hint := 'Set all ' + SigItemDesc[si, sdLong];
|
---|
| 589 | btn.Enabled := StsUsed[si];
|
---|
| 590 | //tab order before listbox but after previous buttons.
|
---|
| 591 | btn.TabOrder := lb.TabOrder;
|
---|
| 592 | Fcb.Add(btn);
|
---|
| 593 | end;
|
---|
| 594 |
|
---|
| 595 | FValidGap := ((FcbX[succ(TSigItemType(0))] - FcbX[TSigItemType(0)] - cbWidth) div 2) + 1;
|
---|
| 596 | FLastValidX := FcbX[FirstValidItem] - FValidGap;
|
---|
| 597 | lb.ControlStyle := lb.ControlStyle + [csAcceptsControls];
|
---|
| 598 |
|
---|
| 599 | try
|
---|
| 600 | ht := SigItemHeight;
|
---|
| 601 | FDy := ((ht - cbHeight) div 2);
|
---|
| 602 | y := lb.TopIndex;
|
---|
| 603 | FOldDrawItemEvent := TExposedListBox(lb).OnDrawItem;
|
---|
| 604 | Flb := lb;
|
---|
| 605 | TExposedListBox(lb).OnDrawItem := lbDrawItem;
|
---|
| 606 | lb.FreeNotification(Self);
|
---|
| 607 |
|
---|
| 608 | for i := 0 to FItems.Count-1 do
|
---|
| 609 | begin
|
---|
| 610 | s := FItems[i];
|
---|
| 611 |
|
---|
| 612 | if piece(s,u,3) = '1' then
|
---|
| 613 | begin
|
---|
| 614 | idx := StrToIntDef(piece(s,U,2),-1);
|
---|
| 615 |
|
---|
| 616 | if idx >= 0 then
|
---|
| 617 | begin
|
---|
| 618 | Flags := piece(s,u,4);
|
---|
| 619 | //loop thru treatment factors
|
---|
| 620 | for sx := low(TSigItemType) to high(TSigItemType) do
|
---|
| 621 | begin
|
---|
| 622 | si := SigItemDisplayOrder[sx];
|
---|
| 623 | StsCode := Flags[ord(si)+1];
|
---|
| 624 | StsIdx := isNA;
|
---|
| 625 |
|
---|
| 626 | for sts := low(ItemStatus) to high(ItemStatus) do
|
---|
| 627 | if StsCode = StsChar[sts] then
|
---|
| 628 | begin
|
---|
| 629 | StsIdx := sts;
|
---|
| 630 | Break;
|
---|
| 631 | end;
|
---|
| 632 |
|
---|
| 633 | if (StsIdx <> isNA) then
|
---|
| 634 | begin
|
---|
| 635 | cb := CreateCB(lb);
|
---|
| 636 | cb.Left := FcbX[sx];
|
---|
| 637 | cb.Top := (ht * (idx - y)) + FDy;
|
---|
| 638 | cb.Tag := ItemToTag(TagInfo(si, idx));
|
---|
| 639 | cb.ShowHint := TRUE;
|
---|
| 640 | cb.Hint := SigItemDesc[si, sdLong];
|
---|
| 641 |
|
---|
| 642 | //CQ3301/3302
|
---|
| 643 | thisTagInfo := TagToItem(cb.Tag);
|
---|
| 644 | itemText := '';
|
---|
| 645 | thisChangeItem := nil; //init
|
---|
| 646 |
|
---|
| 647 | thisChangeItem := TChangeItem(lb.Items.Objects[thisTagInfo.Index]);
|
---|
| 648 |
|
---|
| 649 | if (thisChangeItem <> nil) then
|
---|
| 650 | begin
|
---|
| 651 | itemText := (FilteredString(lb.Items[thisTagInfo.Index]));
|
---|
| 652 | cb.Caption := itemText + cb.Hint; //CQ3301/3302 - gives JAWS a caption to read
|
---|
| 653 | end;
|
---|
| 654 | //end CQ3301/3302
|
---|
| 655 |
|
---|
| 656 | //PATCH: Added OR_3_215v26_70 11/07/2007 jb
|
---|
| 657 | // GWOT - CV Default to Yes.
|
---|
| 658 | if ( (si = siCombatVeteran) and (StsIdx = isUnKnown) ) then
|
---|
| 659 | begin
|
---|
| 660 | StsIdx := isChecked;
|
---|
| 661 | Flags[7] := 'C'; // HD200866 default as Combat Related - GWOT mandated Change
|
---|
| 662 | FItems.SetStrPiece(i, 4, Flags); // HD200866 default as Combat Related - GWOT mandated Change
|
---|
| 663 | end;
|
---|
| 664 | //End Patch
|
---|
| 665 |
|
---|
| 666 | case StsIdx of
|
---|
| 667 | isChecked: cb.State := cbChecked;
|
---|
| 668 | isUnchecked: cb.State := cbUnchecked;
|
---|
| 669 | else cb.State := cbGrayed;
|
---|
| 670 | end; //case
|
---|
| 671 |
|
---|
| 672 | end; //if (StsIdx <> isNA)
|
---|
| 673 |
|
---|
| 674 | end; //for sx := low(TSigItemType) to high(TSigItemType)
|
---|
| 675 |
|
---|
| 676 | end; // if idx >= 0
|
---|
| 677 |
|
---|
| 678 | end; //if piece(s,u,3) = '1'
|
---|
| 679 |
|
---|
| 680 | end; //for i := 0 to FItems.Count-1
|
---|
| 681 |
|
---|
| 682 | finally
|
---|
| 683 | lb.ControlStyle := lb.ControlStyle - [csAcceptsControls];
|
---|
| 684 | end; //if FStsCount > 0
|
---|
| 685 | end;
|
---|
| 686 |
|
---|
| 687 | finally
|
---|
| 688 | FBuilding := FALSE;
|
---|
| 689 | end;
|
---|
| 690 | except
|
---|
| 691 | on ERangeError do
|
---|
| 692 | begin
|
---|
| 693 | ShowMessage('ERangeError in UpdateListBox' + s);
|
---|
| 694 | raise;
|
---|
| 695 | end;
|
---|
| 696 | end;
|
---|
| 697 | end;
|
---|
| 698 |
|
---|
| 699 | procedure TSigItems.cbClicked(Sender: TObject);
|
---|
| 700 | var
|
---|
| 701 | i,cnt,p: integer;
|
---|
| 702 | cb: TORCheckBox;
|
---|
| 703 | sType: TSigItemType;
|
---|
| 704 | idx, Flags: string;
|
---|
| 705 | Info: TSigItemTagInfo;
|
---|
| 706 | wc, w: TWinControl;
|
---|
| 707 |
|
---|
| 708 | begin
|
---|
| 709 | if FBuilding then exit;
|
---|
| 710 | wc := TWinControl(Sender);
|
---|
| 711 | if wc.Tag = AllIdx then
|
---|
| 712 | begin
|
---|
| 713 | FAllCatCheck := not FAllCatCheck;
|
---|
| 714 | for sType := low(TSigItemType) to high(TSigItemType) do
|
---|
| 715 | FAllCheck[sType] := FAllCatCheck;
|
---|
| 716 | cnt := 0;
|
---|
| 717 | for i := 0 to Fcb.Count-1 do
|
---|
| 718 | begin
|
---|
| 719 | w := TWinControl(Fcb[i]);
|
---|
| 720 | if (w <> wc) and (w.Tag >= ColIdx) and (w is TButton) then
|
---|
| 721 | begin
|
---|
| 722 | inc(cnt);
|
---|
| 723 | if w.Enabled then
|
---|
| 724 | TButton(w).Click;
|
---|
| 725 | if cnt >= FlagCount then break;
|
---|
| 726 | end;
|
---|
| 727 | end;
|
---|
| 728 | end
|
---|
| 729 | else
|
---|
| 730 | if wc.Tag >= ColIdx then
|
---|
| 731 | begin
|
---|
| 732 | sType := TSigItemType(wc.Tag - ColIdx);
|
---|
| 733 | FAllCheck[sType] := not FAllCheck[sType];
|
---|
| 734 | for i := 0 to Fcb.Count-1 do
|
---|
| 735 | begin
|
---|
| 736 | w := TWinControl(Fcb[i]);
|
---|
| 737 | if (w.Tag < ColIdx) and (w is TORCheckBox) then
|
---|
| 738 | begin
|
---|
| 739 | if TagToItem(w.Tag).SigType = sType then
|
---|
| 740 | TORCheckBox(w).Checked := FAllCheck[sType];
|
---|
| 741 | end;
|
---|
| 742 | end;
|
---|
| 743 | end
|
---|
| 744 | else
|
---|
| 745 | begin
|
---|
| 746 | cb := TORCheckBox(wc);
|
---|
| 747 | info := TagToItem(cb.Tag);
|
---|
| 748 | if info.Index >= 0 then
|
---|
| 749 | begin
|
---|
| 750 | idx := inttostr(info.Index);
|
---|
| 751 | i := FItems.IndexOfPiece(idx,U,2);
|
---|
| 752 | if i >= 0 then
|
---|
| 753 | begin
|
---|
| 754 | p := ord(Info.SigType)+1;
|
---|
| 755 | Flags := piece(FItems[i],U,4);
|
---|
| 756 | case cb.State of
|
---|
| 757 | cbUnchecked: Flags[p] := StsChar[isUnchecked];
|
---|
| 758 | cbChecked: Flags[p] := StsChar[isChecked];
|
---|
| 759 | else Flags[p] := StsChar[isUnknown];
|
---|
| 760 | end;
|
---|
| 761 | FItems.SetStrPiece(i,4,Flags);
|
---|
| 762 | if BILLING_AWARE then
|
---|
| 763 | UBAGlobals.BAFlagsIN := Flags;
|
---|
| 764 | end;
|
---|
| 765 | end;
|
---|
| 766 | end;
|
---|
| 767 | end;
|
---|
| 768 |
|
---|
| 769 | procedure TSigItems.cbEnter(Sender: TObject);
|
---|
| 770 | var
|
---|
| 771 | cb: TORCheckBox;
|
---|
| 772 | begin
|
---|
| 773 | cb := TORCheckBox(Sender);
|
---|
| 774 | cb.Color := clHighlight;
|
---|
| 775 | cb.Font.Color := clHighlightText;
|
---|
| 776 |
|
---|
| 777 | // commented out causing check box states to be out of sync when
|
---|
| 778 | //checked individually and/or when by column or all.
|
---|
| 779 | //CQ5074
|
---|
| 780 | if ( (cb.Focused) and (cb.State = cbGrayed) ) and (not IsAMouseButtonDown) then
|
---|
| 781 | cb.Checked := false;
|
---|
| 782 | //end CQ5074
|
---|
| 783 | end;
|
---|
| 784 |
|
---|
| 785 | procedure TSigItems.cbExit(Sender: TObject);
|
---|
| 786 | var
|
---|
| 787 | cb: TORCheckBox;
|
---|
| 788 | begin
|
---|
| 789 | cb := TORCheckBox(Sender);
|
---|
| 790 | cb.Color := clWindow;
|
---|
| 791 | cb.Font.Color := clWindowText;
|
---|
| 792 | end;
|
---|
| 793 |
|
---|
| 794 |
|
---|
| 795 | procedure TSigItems.lbDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
|
---|
| 796 | var
|
---|
| 797 | OldRect: TRect;
|
---|
| 798 | i: integer;
|
---|
| 799 | cb: TORCheckBox;
|
---|
| 800 | si: TSigItemType;
|
---|
| 801 | DrawGrid: boolean;
|
---|
| 802 |
|
---|
| 803 | begin
|
---|
| 804 | DrawGrid := (Index < flb.Items.Count);
|
---|
| 805 | if DrawGrid and (trim(Flb.Items[Index]) = '') and
|
---|
| 806 | (Index = (flb.Items.Count - 1)) then
|
---|
| 807 | DrawGrid := FALSE;
|
---|
| 808 | if DrawGrid then
|
---|
| 809 | dec(Rect.Bottom);
|
---|
| 810 | OldRect := Rect;
|
---|
| 811 |
|
---|
| 812 | Rect.Right := FlastValidX - 4;
|
---|
| 813 | {Begin BillingAware}
|
---|
| 814 | if BILLING_AWARE then Rect.Right := FLastValidX - 55;
|
---|
| 815 | {End BillingAware}
|
---|
| 816 |
|
---|
| 817 | if assigned(FOldDrawItemEvent) then
|
---|
| 818 | FOldDrawItemEvent(Control, Index, Rect, State)
|
---|
| 819 | else
|
---|
| 820 | begin
|
---|
| 821 | Flb.Canvas.FillRect(Rect);
|
---|
| 822 | if Index < flb.Items.Count then
|
---|
| 823 | Flb.Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top, FilteredString(Flb.Items[Index]));
|
---|
| 824 | end;
|
---|
| 825 |
|
---|
| 826 | if DrawGrid then
|
---|
| 827 | begin
|
---|
| 828 | Flb.Canvas.Pen.Color := clBtnFace;
|
---|
| 829 | Flb.Canvas.MoveTo(Rect.Left, Rect.Bottom);
|
---|
| 830 | Flb.Canvas.LineTo(OldRect.RIght, Rect.Bottom);
|
---|
| 831 | end;
|
---|
| 832 |
|
---|
| 833 | if BILLING_AWARE then OldRect.Left := Rect.Right + 90
|
---|
| 834 | else OldRect.Left := Rect.Right;
|
---|
| 835 |
|
---|
| 836 | //// SC Column
|
---|
| 837 | Flb.Canvas.FillRect(OldRect);
|
---|
| 838 | for i := 0 to Fcb.Count-1 do
|
---|
| 839 | begin
|
---|
| 840 | cb := TORCheckBox(Fcb[i]);
|
---|
| 841 |
|
---|
| 842 | if TagToItem(cb.Tag).Index = Index then
|
---|
| 843 | begin
|
---|
| 844 | cb.Invalidate;
|
---|
| 845 | cb.Top := Rect.Top + FDy;
|
---|
| 846 | end;
|
---|
| 847 | end;
|
---|
| 848 |
|
---|
| 849 | // EI Columns
|
---|
| 850 | if DrawGrid then
|
---|
| 851 | begin
|
---|
| 852 | for si := low(TSigItemType) to high(TSigItemType) do
|
---|
| 853 | begin
|
---|
| 854 | if FcbX[si] > FLastValidX then
|
---|
| 855 | begin
|
---|
| 856 | Flb.Canvas.MoveTo(FcbX[si] - FValidGap, Rect.Top);
|
---|
| 857 | Flb.Canvas.LineTo(FcbX[si] - FValidGap, Rect.Bottom);
|
---|
| 858 | end;
|
---|
| 859 | end;
|
---|
| 860 | end;
|
---|
| 861 |
|
---|
| 862 | end;
|
---|
| 863 |
|
---|
| 864 | procedure TSigItems.Notification(AComponent: TComponent;
|
---|
| 865 | Operation: TOperation);
|
---|
| 866 | begin
|
---|
| 867 | inherited;
|
---|
| 868 | if (AComponent = Flb) and (Operation = opRemove) then
|
---|
| 869 | begin
|
---|
| 870 | Fcb.Clear;
|
---|
| 871 | TExposedListBox(Flb).OnDrawItem := FOldDrawItemEvent;
|
---|
| 872 | FOldDrawItemEvent := nil;
|
---|
| 873 | Flb := nil;
|
---|
| 874 | end;
|
---|
| 875 | end;
|
---|
| 876 |
|
---|
| 877 | procedure TSigItems.EnableSettings(Index: integer; Checked: boolean);
|
---|
| 878 | var
|
---|
| 879 | cb: TORCheckBox;
|
---|
| 880 | i: integer;
|
---|
| 881 | Info: TSigItemTagInfo;
|
---|
| 882 |
|
---|
| 883 | begin
|
---|
| 884 | if Index < 0 then exit;
|
---|
| 885 | for i := 0 to Fcb.Count-1 do
|
---|
| 886 | begin
|
---|
| 887 | if TObject(Fcb[i]) is TORCheckBox then
|
---|
| 888 | begin
|
---|
| 889 | cb := TORCheckBox(Fcb[i]);
|
---|
| 890 | info := TagToItem(cb.Tag);
|
---|
| 891 | if info.Index = Index then
|
---|
| 892 | cb.enabled := Checked;
|
---|
| 893 | end;
|
---|
| 894 | end;
|
---|
| 895 | i := FItems.IndexOfPiece(IntToStr(Index), U, 2);
|
---|
| 896 | if i >= 0 then
|
---|
| 897 | FItems.SetStrPiece(i, 5, BoolChar[not Checked]);
|
---|
| 898 | end;
|
---|
| 899 |
|
---|
| 900 | function TSigItems.OK2SaveSettings: boolean;
|
---|
| 901 | var
|
---|
| 902 | i, Index: integer;
|
---|
| 903 | s: string;
|
---|
| 904 |
|
---|
| 905 | begin
|
---|
| 906 | {Begin BillingAware}
|
---|
| 907 | if BILLING_AWARE then
|
---|
| 908 | begin
|
---|
| 909 | if Assigned(UBAGlobals.BAOrderList) then
|
---|
| 910 | BAOrderList.Clear
|
---|
| 911 | else
|
---|
| 912 | begin
|
---|
| 913 | BAOrderList := TStringList.Create;
|
---|
| 914 | BAOrderList.Clear;
|
---|
| 915 | end;
|
---|
| 916 | {End BillingAware}
|
---|
| 917 | end;
|
---|
| 918 |
|
---|
| 919 | Result := TRUE;
|
---|
| 920 | for i := 0 to FItems.Count-1 do
|
---|
| 921 | begin
|
---|
| 922 | s := FItems[i];
|
---|
| 923 | Index := StrToIntDef(piece(s,U,2),-1);
|
---|
| 924 | if(Index >= 0) and (piece(s,U,5) <> '1') then
|
---|
| 925 | begin
|
---|
| 926 | if pos(StsChar[isUnknown], piece(s, U, 4)) > 0 then
|
---|
| 927 | begin
|
---|
| 928 | Result := FALSE;
|
---|
| 929 | break;
|
---|
| 930 | end{end if}
|
---|
| 931 | else
|
---|
| 932 | if BILLING_AWARE then
|
---|
| 933 | BAOrderList.Add(piece(s,U,1)+ piece(s,U,3) + piece(s,U,4)); //baph1
|
---|
| 934 | end; {end if}
|
---|
| 935 | end;{end for}
|
---|
| 936 | end;
|
---|
| 937 |
|
---|
| 938 | procedure TSigItems.SaveSettings;
|
---|
| 939 | var
|
---|
| 940 | s: string;
|
---|
| 941 | i, Index: integer;
|
---|
| 942 | TmpSL: TStringList;
|
---|
| 943 |
|
---|
| 944 | begin
|
---|
| 945 | TmpSL := TStringList.Create;
|
---|
| 946 |
|
---|
| 947 | try
|
---|
| 948 | for i := 0 to FItems.Count-1 do
|
---|
| 949 | begin
|
---|
| 950 | s := FItems[i];
|
---|
| 951 | Index := StrToIntDef(piece(s,U,2),-1);
|
---|
| 952 | if(Index >= 0) and (piece(s,U,5) <> '1') then
|
---|
| 953 | begin
|
---|
| 954 | TmpSL.Add(Piece(s,U,1) + U + piece(s,U,4));
|
---|
| 955 | FItems.SetStrPiece(i, 6, '1');
|
---|
| 956 | end;
|
---|
| 957 | end;
|
---|
| 958 |
|
---|
| 959 | SaveCoPayStatus(TmpSL);
|
---|
| 960 |
|
---|
| 961 | finally
|
---|
| 962 | TmpSL.Free;
|
---|
| 963 | end;
|
---|
| 964 | i := 0;
|
---|
| 965 | while i < FItems.Count do
|
---|
| 966 | begin
|
---|
| 967 | if Piece(FItems[i], U, 6) = '1' then
|
---|
| 968 | FItems.Delete(i)
|
---|
| 969 | else
|
---|
| 970 | inc(i);
|
---|
| 971 | end;
|
---|
| 972 | Fcb.Clear;
|
---|
| 973 | end;
|
---|
| 974 |
|
---|
| 975 | { Begin Billing Aware }
|
---|
| 976 |
|
---|
| 977 | procedure TSigItems.DisplayUnsignedStsFlags(sFlags:string);
|
---|
| 978 | var
|
---|
| 979 | Index: integer;
|
---|
| 980 | flags : string;
|
---|
| 981 | begin
|
---|
| 982 | Index := 0;
|
---|
| 983 | Flags := sFlags;
|
---|
| 984 | CopyCBValues(Index,Index);
|
---|
| 985 |
|
---|
| 986 | end;
|
---|
| 987 |
|
---|
| 988 | procedure TSigItems.DisplayPlTreatmentFactors;
|
---|
| 989 | var
|
---|
| 990 | FactorsOut:TStringList;
|
---|
| 991 | y: integer;
|
---|
| 992 | Index: integer;
|
---|
| 993 | begin
|
---|
| 994 | FactorsOut := TStringList.Create;
|
---|
| 995 | FactorsOut.Clear;
|
---|
| 996 | FactorsOut := UBAGlobals.PLFactorsIndexes;
|
---|
| 997 | for y := 0 to FactorsOut.Count-1 do
|
---|
| 998 | begin
|
---|
| 999 | Index := StrToInt(Piece(FactorsOut.Strings[y],U,1));
|
---|
| 1000 | CopyCBValues(Index,Index);
|
---|
| 1001 | end;
|
---|
| 1002 | end;
|
---|
| 1003 |
|
---|
| 1004 |
|
---|
| 1005 |
|
---|
| 1006 | procedure TSigItems.CopyCBValues(FromIndex, ToIndex: integer);
|
---|
| 1007 | var
|
---|
| 1008 | si: TSigItemType;
|
---|
| 1009 | FromTag, ToTag: integer;
|
---|
| 1010 | FromCB, ToCB: TORCheckBox;
|
---|
| 1011 | x: string;
|
---|
| 1012 | begin
|
---|
| 1013 | tempCkBx.GrayedStyle := gsBlueQuestionMark;
|
---|
| 1014 |
|
---|
| 1015 | for si := low(TSigItemType) to high(TSigItemType) do
|
---|
| 1016 | begin
|
---|
| 1017 | FromTag := ItemToTag(TagInfo(si, FromIndex));
|
---|
| 1018 | ToTag := ItemToTag(TagInfo(si, ToIndex));
|
---|
| 1019 | FromCB := FindCBValues(FromTag);
|
---|
| 1020 | ToCB := FindCBValues(ToTag);
|
---|
| 1021 |
|
---|
| 1022 | if assigned(FromCB) then // and assigned(ToCB)) then
|
---|
| 1023 | begin
|
---|
| 1024 | tempCkBx.State := cbGrayed;
|
---|
| 1025 | x:= GetTempCkBxState(FromIndex,si);
|
---|
| 1026 | if x = 'C' then tempCkBx.State := cbChecked
|
---|
| 1027 | else if x = 'U' then tempCkBx.State := cbUnChecked ;
|
---|
| 1028 | ToCB.State := tempCkBx.State;// FromCB.State;
|
---|
| 1029 | end;
|
---|
| 1030 | end; //for
|
---|
| 1031 |
|
---|
| 1032 | end;
|
---|
| 1033 |
|
---|
| 1034 | function TSigItems.FindCBValues(ATag: integer):TORCheckBox;
|
---|
| 1035 | var
|
---|
| 1036 | i: integer;
|
---|
| 1037 | wc: TWinControl;
|
---|
| 1038 | begin
|
---|
| 1039 | for i := 0 to Fcb.Count-1 do
|
---|
| 1040 | begin
|
---|
| 1041 | wc := TWinControl(Fcb[i]);
|
---|
| 1042 | if(wc is TORCheckBox) and (wc.Tag = ATag) then
|
---|
| 1043 | begin
|
---|
| 1044 | Result := TORCheckBox(wc);
|
---|
| 1045 | Exit;
|
---|
| 1046 | end;
|
---|
| 1047 | end;
|
---|
| 1048 | Result := nil;
|
---|
| 1049 | end;
|
---|
| 1050 |
|
---|
| 1051 | function TSigItems.GetTempCkBxState(Index: integer; CBValue:TSIGItemType):string;
|
---|
| 1052 | var
|
---|
| 1053 | locateIdx,thisIdx,i: integer;
|
---|
| 1054 | iFactor: integer;
|
---|
| 1055 | TmpCBStatus : string;
|
---|
| 1056 | begin
|
---|
| 1057 | try
|
---|
| 1058 | locateIdx := Index;
|
---|
| 1059 | iFactor := Ord(CBValue) +1;
|
---|
| 1060 | for i := 0 to UBAGlobals.BAFlagsOut.count-1 do
|
---|
| 1061 | begin
|
---|
| 1062 | thisIdx := StrToInt(Piece(UBAGlobals.BAFlagsOut.Strings[i],U,1));
|
---|
| 1063 | if thisIdx = locateIdx then
|
---|
| 1064 | begin
|
---|
| 1065 | TmpCBStatus := Piece(UBAGlobals.BAFlagsOut.Strings[i],U,2);
|
---|
| 1066 | TmpCBStatus := Copy(TmpCBStatus,iFactor,1);
|
---|
| 1067 | Result :=TmpCBStatus;
|
---|
| 1068 | end;
|
---|
| 1069 | end;
|
---|
| 1070 | except
|
---|
| 1071 | on EAccessViolation do
|
---|
| 1072 | begin
|
---|
| 1073 | {$ifdef debug}ShowMessage('EAccessViolation in uSignItems.GetTempCkBxState()');{$endif}
|
---|
| 1074 | raise;
|
---|
| 1075 | end;
|
---|
| 1076 | end;
|
---|
| 1077 | end;
|
---|
| 1078 | { End Billing Aware }
|
---|
| 1079 |
|
---|
| 1080 |
|
---|
| 1081 | initialization
|
---|
| 1082 | FlagCount := ord(high(TSigItemType)) - ord(low(TSigItemType)) + 1;
|
---|
| 1083 | BaseFlags := StringOfChar(StsChar[isNA], FlagCount);
|
---|
| 1084 | thisChangeItem := TChangeItem.Create; //CQ3301/3302
|
---|
| 1085 |
|
---|
| 1086 | finalization
|
---|
| 1087 | FreeAndNil(uSigItems);
|
---|
| 1088 |
|
---|
| 1089 | end.
|
---|
| 1090 |
|
---|