<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<AEUMUpdate>
  <Name>upd234</Name>
  <ApplicationID>APROP</ApplicationID>
  <Archive>false</Archive>
  <Comment></Comment>
  <Version Major="6" Minor="7" Release="234" Build="1"/>
  <VersionMin Major="6" Minor="7" Release="233" Build="1"/>
  <FirstStep>2772</FirstStep>
  <Step UpdateType="Query" StepNumber="2772" DllName="" DllProcName="" PostgreSQL="" OracleSQL="" FirebirdSQL="update invoices inv1 set inv1.in_includeindds = (select inv2.in_includeindds from invoices inv2 where inv2.in_id = inv1.in_leadinid)
where (inv1.in_includeindds = '') or (inv1.in_includeindds is null);" PostgreMany="false" OracleMany="false" FirebirdMany="false" ContinueOnError="false"/>
  <Step UpdateType="Query" StepNumber="2773" DllName="" DllProcName="" PostgreSQL="" OracleSQL="" FirebirdSQL="CREATE OR ALTER TRIGGER INDETAIL_BI FOR INDETAIL
ACTIVE BEFORE INSERT POSITION 0
AS
declare variable OpID integer;
declare variable OpUnitID integer;
declare variable PayDate date;
declare variable PayType char(1);
declare variable PayWay char(1);
declare variable Anul char(1);
declare variable DDS numeric(15,3);
declare variable DDSSum numeric(15, 3);
declare variable cnt integer;
BEGIN
    NEW.ID_NoFactorSum  = NEW.ID_Sum;

    select IN_OperatorID, IN_PayDate, IN_PayType, IN_PayDDS, IN_PayDDSSum, IN_OperatorUnitID, IN_PayWay, IN_Anul
    from Invoices 
    where IN_ID = NEW.ID_ID
    into :OpID, :PayDate, :PayType, :DDS, :DDSSum, :OpUnitID, :PayWay, :Anul;

    execute procedure DayPaymentsAdd(:OpID, :PayDate, NEW.ID_AccNo, NEW.ID_PartNo,
            New.ID_SUM, :PayType, NEW.ID_ID, NEW.ID_BIN, NEW.ID_UNITID, :PayWay, :Anul, :PayType, :OpUnitID);

    /* otrazqwa w daypayments DDSto */
    if ((New.ID_DDS &lt;&gt; 0) and (New.ID_DDS is not null)) then
      execute procedure DayPaymentsAdd(:OpID, :PayDate, NEW.ID_AccNo_D, NEW.ID_PartNo_D,
                                       NEW.ID_DDS, 'D', NEW.ID_ID, NEW.ID_BIN_D, NEW.ID_UNITID_D, :PayWay, :Anul, :PayType, :OpUnitID);

    /* otrazqwa w daypayments lihvite */
    if ((New.ID_Lihvi &lt;&gt; 0) and (New.ID_Lihvi is not null)) then
      execute procedure DayPaymentsAdd(:OpID, :PayDate, NEW.ID_AccNo_L, NEW.ID_PartNo_L,
                                        New.ID_Lihvi, 'L', NEW.ID_ID, NEW.ID_BIN_L, NEW.ID_UNITID_L, :PayWay, :Anul, :PayType, :OpUnitID);
 /*
    if ( ( New.ID_DDS &lt;&gt; 0) and (DDSSum &lt;&gt; 0) ) then
    begin
      New.ID_DDS = (New.ID_SUM / DDSSum) * DDS;
      New.ID_ALL = (NEW.ID_SUM + NEW.ID_LIHVI + NEW.ID_DDS);
    end
  */
END" PostgreMany="false" OracleMany="false" FirebirdMany="false" ContinueOnError="false"/>
  <Step UpdateType="Query" StepNumber="2774" DllName="" DllProcName="" PostgreSQL="" OracleSQL="" FirebirdSQL="update system_strings set sys_str = '6.7.234.1' where sys_id = 1401;" PostgreMany="false" OracleMany="false" FirebirdMany="false" ContinueOnError="false"/>
</AEUMUpdate>
