Org [2]; _FUNCTIONS. AsString: = Org [3]; _NAME. AsString: = Org [4]; _TEL. AsString: = Org [6]; _NAME. AsString: = Org [5]; _TEL. AsString: = Org [7]; _EDIT. AsString: = Login; _EDIT. Value: = Date;. Post; _ID: = ADOTableOrgORG_ID. AsInteger; else begin. Insert;. AsString: = Copy (Org [0], 1,3);. AsString: = Copy (Org [0], 5,3); _NUM. AsString: = Copy (Org [0], 9,6);. AsString: = Org [1];. AsString: = Org [2]; _FUNCTIONS. AsString: = Org [3]; _NAME. AsString: = Org [4]; _TEL. AsString: = Org [6]; _NAME. AsString: = Org [5]; _TEL. AsString: = Org [7]; _EDIT. AsString: = Login; _EDIT. Value: = Date;. Post;. SQL. Clear;. SQL. Add ('SELECT ORG_ID FROM ORG WHERE' + '(AREA =' + (Org [0], 1,3) + ') AND' + '(REGION =' + Copy (Org [0], 5,3) +
') AND' + '(REG_NUM =' + Copy (Org [0], 9,6) + ')');. Active: = True; _ID: = ADOQueryID. Fields [0]. AsInteger;. Active: = False;;: = ADOTablePeriod. Lookup ('ORG_ID; YEAR; KVARTAL', VarArrayOf ([ORG_ID, (Period [1]), Period [2]]), 'ORG_ID'); not VarIsNull (V) then begin. Locate ('ORG_ID; YEAR; KVARTAL', VarArrayOf ([ORG_ID, (Period [1]), Period [2]]), []);. Edit; _SOST. AsString: = Period [0]; _SOTR. AsString: = Period [3]; _EDIT. AsString: = Login; _EDIT. Value: = Date;. Post; _ID: = ADOTablePeriodPERIOD_ID. AsInteger; else begin. Insert; _ID. AsInteger: = ORG_ID; _SOST. AsString: = Period [0];. AsString: = Period [1];. AsString: = Period [2]; _SOTR. AsString: = Period [3]; _ADD. AsString: = Login; _ADD. Value: = Date;. Post;. SQL. Clear;. SQL. Add ('SELECT PERIOD_ID FROM PERIOD WHERE' + '(ORG_ID =' + (ORG_ID) + ') AND' + '(YEAR =' + Period [1] + ') AND' +
'(KVARTAL =''' + Period [2] +'' ')');. Active: = True; _ID: = ADOQueryID. Fields [0]. AsInteger;. Active: = False;;: = XMLDoc. DocumentElement. ChildNodes [Lvl1]. ChildNodes; I: = 2 to NodesPodrazd. Count-1 do begin (XMLDoc. DocumentElement. ChildNodes [Lvl1]. ChildNodes [I]. NodeName = 'Підрозділ') and
(XMLDoc. DocumentElement. ChildNodes [Lvl1]. ChildNodes [I]. HasChildNodes) then begin [0]: = VarToStr (XMLDoc. DocumentElement. ChildNodes [Lvl1]. ChildNodes [I]. ChildNodes [ 'НомерПодраз']. Text); [1]: = VarToStr (XMLDoc. DocumentElement. ChildNodes [Lvl1]. ChildNodes [I]. ChildNodes ['НазваніеПодраз']. Text); [2]: = VarToStr (XMLDoc. DocumentElement. ChildNodes [Lvl1]. ChildNodes [I]. ChildNodes ['РаботаПодраз']. Text); [3]: = VarToStr (XMLDoc. DocumentElement. ChildNodes [Lvl1]. ChildNodes [I]. ChildNodes ['КолСотрПодраз']. Text) ;: = ADOTablePodrazd. Lookup ('ORG_ID; NUM', VarArrayOf ([ORG_ID, [0]]), 'ORG_ID'); not VarIsNull (V) then begin. Locate ('ORG_ID; NUM', VarArrayOf ([ORG_ID, Podrazd [0]]),