Dim PriznakQuery
Dim PriznakDocument
Dim SummaPr

Function MTStrFormat1(inString)
    dr=inString
    if(isnull(dr)) then
      StrNewMoney ="0-00"
    else
      d_int=int(dr)
      d_dbl=cdbl(dr)
      k_dbl=(d_dbl-cdbl(d_int))*100
      k_dbl=Round(k_dbl,0)

      if (k_dbl=0) then
        k_dbl="00"
       else
        if (k_dbl<10) then k_dbl="0" & k_dbl
        if (k_dbl>9) then
          k_dbl=cstr(k_dbl)
        end if
      end if
      StrNewMoney  =cstr(d_int) & "-" & k_dbl
    end if
    MTStrFormat1 =StrNewMoney
End Function



Function ExecFile (filename)
 Set fso = CreateObject("Scripting.FileSystemObject")
 t=fso.getfolder("macroses") & "\" & filename
 SET ts=FSo.OpenTextFile (t,1,True,0)
 s = ts.ReadAll
 ts.Close
 Set fso=Nothing
 Execute s
end function

Function ON_Create(inBLOB)
ON_Create = "1"
end function

Function ON_Open(inBLOB)

SummaPr = inBLOB

set query=self.Controls("IBQuery1")
PriznakDocument=query.fieldbynamestring("kindoper")
if (isnull(PriznakDocument)) then PriznakDocument=cint(PriznakDocument)

if (PriznakDocument=1) then execfile ("PlatPorFormBr.txt")
if (PriznakDocument=2) then execfile ("PlatTrFormBr.txt")
if (PriznakDocument=3) then execfile ("MemOrdValFormBr.txt")
if (PriznakDocument=4) then execfile ("MemOrdValFormBr.txt")
if (PriznakDocument=6) then execfile ("InkPorFormBr.txt")
if (PriznakDocument=9) then execfile ("MemOrdValFormBr.txt")
if (PriznakDocument=16) then execfile ("PlatOrdFormBr.txt")

ON_OPEN="1"
end function

Function ON_SignDoc(inBLOB)
 ON_SignDoc = "1"
end function

Function ON_Delete(inBLOB)
 ON_Delete = "1"
end function


sub C01_PPPrevPlatPorBtn_onClick
'  -  
execfile ("PlatPorViewBr.txt")
end sub

sub  C02_PTPrevOrderBtn_onClick
'  -  
execfile ("PlatTrViewBr.txt")
end sub

sub C06_IPFPrevInkPoBtn_onClick
'   -  
execfile ("InkPorViewBr.txt")
end sub

sub  MOVFPrev_onClick
'  -  
execfile ("MemOrdValViewBr.txt")
end sub

sub  C16_POFPrevOrderBtn_onClick
'  -  
execfile ("PlatOrdViewBr.txt")
end sub

