/*ALIAS>prop_db*/

/*SQLStart>1486*/
insert into obunits (unit_perid) values (0);
/*SQLStop>1486*/

/*SQLStart>1487*/
alter table obunits 
  add unit_beginsaldo numeric(15,2),
  add unit_beginsaldoeditdate date,
  add unit_beginsaldodate date;
/*SQLStop>1487*/

/*SQLStart>1488*/
update  obunits 
set  unit_beginsaldo = 0.0;
/*SQLStop>1488*/

/*SQLStart>1489*/
CREATE INDEX INCLEARPAYDATEINDEX ON INVOICES (IN_CLEARPAYDATE);
/*SQLStop>1489*/

/*SQLStart>1490*/
alter table persons add per_clearegn varchar(15);
/*SQLStop>1490*/

/*SQLStart>1491*/
update persons set per_clearegn = aclearstr(per_egn);
/*SQLStop>1491*/

/*SQLStart>1492*/
CREATE INDEX PERCLEAREGNINDEX ON PERSONS (PER_CLEAREGN);
/*SQLStop>1492*/

/*SQLStart>1494*/
ALTER TRIGGER SET_PER_ID
AS
BEGIN
  NEW.Per_ID=GEN_ID(Per_ID_GEN,1);
  New.Per_Name = ATrimEx(New.Per_Name);
  New.Per_CLEARNAME = ACLearStr(New.Per_Name);
  New.Per_CLEAREGN = ACLearStr(New.Per_EGN);
END
/*SQLStop>1494*/

/*SQLStart>1495*/
ALTER TRIGGER PERSONS_BU
AS
BEGIN
  New.Per_Name = ATrimEx(New.Per_Name);
  New.Per_CLEARNAME = ACLearStr(New.Per_Name);
  New.Per_CLEAREGN = ACLearStr(New.Per_EGN);
END
/*SQLStop>1495*/