Procedure

TfrmSignOrders.Paste1Click

Module

fOrdersSign

Last Modified

7/15/2014 3:26:42 PM

Comments

- Populate 'target' orders of a copy/paste operation with contents of 'source' order

Visibility

Public/Published

Owner

TfrmSignOrders

Declaration

procedure Paste1Click(Sender: TObject);

Calls Hierarchy


TfrmSignOrders.Paste1Click
 ├IsOrderBillable
 │ └PrepOrderID
 ├CopyTFCIToTargetOrder
 └TfrmSignOrders.SetCheckBoxStatus
   └TSigItems.SetSigItems
     └TSigItems.CopyCB
       ├TSigItems.ItemToTag
       ├TSigItems.TagInfo
       └TSigItems.FindCB

Calls

Name Declaration Comments
CopyTFCIToTargetOrder procedure CopyTFCIToTargetOrder(thisTargetOrderID: string; thisCheckBoxStatus: string); -
IsOrderBillable function IsOrderBillable(pOrderID: string):boolean; -
TfrmSignOrders.SetCheckBoxStatus procedure SetCheckBoxStatus(thisOrderID: string); -


Source

1513  procedure TfrmSignOrders.Paste1Click(Sender: TObject);
1514  {
1515   - Populate 'target' orders of a copy/paste operation with contents of 'source' order
1516  }  
1517  var
1518    i: byte;
1519    newRec: TBADxRecord;
1520  begin
1521    if BILLING_AWARE then
1522       begin
1523        if not Assigned(fOrdersSign.CopyBuffer) then //CQ5414
1524          fOrdersSign.CopyBuffer := TBADxRecord.Create; //CQ5414
1525  
1526       try
1527           for i := 0 to clstOrders.Count - 1 do
1528                 begin
1529                 if (fOrdersSign.frmSignOrders.clstOrders.Selected[i]) then
1530                   begin
1531                     fOrdersSign.targetOrderID := TChangeItem(fOrdersSign.frmSignOrders.clstOrders.Items.Objects[i]).ID;
1532  
1533                    if fOrdersSign.targetOrderID = fOrdersSign.srcOrderID then //disallow copying an order to itself
1534                       Continue
1535                    else
1536                       begin
1537                         fOrdersSign.CopyBuffer.FOrderID := BUFFER_ORDER_ID;
1538  
1539                       //***************************************************************
1540                       if Not UBACore.IsOrderBillable(targetOrderID) then
1541                         begin
1542                           ShowMsg(BA_NA_PASTE_DISALLOWED);
1543                           fOrdersSign.targetOrderID := '';
1544                           Continue;
1545                         end;
1546                       //***************************************************************
1547  
1548                       newRec := TBADxRecord.Create;
1549                       with newRec do
1550                         begin
1551                           FOrderID :=  fOrdersSign.targetOrderID;
1552                           FBADxCode := CopyBuffer.FBADxCode;
1553                           FBASecDx1 := CopyBuffer.FBASecDx1;
1554                           FBASecDx2 := CopyBuffer.FBASecDx2;
1555                           FBASecDx3 := CopyBuffer.FBASecDx3;
1556                         end;
1557  
1558                      tempDxList.Add(newRec);
1559  
1560                      CopyTFCIToTargetOrder( fOrdersSign.targetOrderID, fOrdersSign.chkBoxStatus);
1561                      SetCheckBoxStatus( fOrdersSign.targetOrderID);  //calls uSignItems.SetSigItems()
1562                    end;
1563                   end;
1564                 end;
1565       except
1566          on EListError do
1567             begin
1568               ShowMsg('EListError in frmSignOrders.Paste1Click()'+#13+'for i := 0 to clstOrders.Count - 1 do');
1569             raise;
1570             end;
1571       end;
1572           clstOrders.Refresh; //Update grid to show pasted Dx
1573       end;
1574  end;