Cp1251
doc
document_title="История приходов по поставщику"
document_width=800
document_height=800

postloadscript = "($X
                     ($debug 'ARGUMENTS.0: ' + ARGUMENTS.0 + ' (' + ($ARGUMENTS.0@type) + ')')
                     ($ret '')
                  )"


{ toolbar BACKGROUND=LIGHTGRAY
{ splitpanel type = horizontal percent = 10
{form
   {label
       value="Дата док. с"    
       left=10    top=8    height=20       width=70
       font_size=12         font_family=0   bg_color="#c0c0c0"
   }
   {field
       target=month_ago  border = box
       left=80    top=8    height=20       width=100
       alias=dat1        font_size=12    font_family=0    bg_color="#ffffff"
       dep="n_dat1"
   }
      {field  visible=no
        alias=n_dat1  type=string
        left=75  top=30  height=20  width=70
        exp="($X
                (g.n_dat1 = ($($@date g.dat1)@toPLString))
                ($g.grid1@retrieve)
                ($ret '')
             )"
      }       
   {label
       value="по"
       left=190    top=8    height=20       width=30
       font_size=12         font_family=0   bg_color="#c0c0c0"
   }
   {field
       target=today  border = box
       left=220    top=8    height=20       width=100
       alias=dat2        font_size=12    font_family=0    bg_color="#ffffff"
       dep="n_dat2"
   }
      {field  visible=no
        alias=n_dat2  type=string
        left=75  top=30  height=20  width=70
        exp="($X
                (g.n_dat2 = ($($@date g.dat2)@toPLString))
                ($g.grid1@retrieve)
                ($ret '')
             )"
      }       

      {datastore  alias=date_ds
        query="select today, month_ago, kvartal
                 from (
               select trunc(sysdate) today,
                      add_months(trunc(sysdate), -1) month_ago,
                      add_months(trunc(sysdate), -3) kvartal
                 from dual
                      )"
        
      }

}
{grid
buttonbar_font_family = 0     buttonbar_font_size = 12
buttonbar_size = 30           titlebar_size = 18          titlebar_height = 40
rowsize = 20                  editable = no
return = yes                   alias = grid1
multiselect = yes

//{column size=70  
//   title="Дата док."   
//   target=date_sd  title_font_family=2   halignment=center
//   font_color="#000000"    font_size=12            font_family=0
//}
//{column size=80  
//   title="N док."   
//   target=num_sd  title_font_family=2   halignment=left
//   font_color="#000000"    font_size=12            font_family=0
//}
{column size=70  
   title="Код" 
   target=active.id_active        title_font_family=2   halignment=center editmask = "##0."
   font_color="#000000"    font_size=12            font_family=0
}
{column size=200  
   title="Название" 
   target=active.name_active        title_font_family=2   halignment=left
   font_color="#000000"    font_size=12            font_family=0
}
{column size=70  
   title="Цена"   
   target=price1_spc  title_font_family=2   halignment=right
   font_color="#000000"    font_size=12            font_family=0
   editmask = "# #0.00"
}
{column size=70  
   title="Кол-во"   
   target=q1_spc  title_font_family=2   halignment=right
   font_color="#000000"    font_size=12            font_family=0
   editmask = "# #0.000"
}

{datastore 
 alias = ds
 query = "select active.id_active, active.name_active, q1_spc, price1_spc,
                 id_pseudo_unit, obozn
            from (
          select --head.id_head, head.num_sd, head.date_sd, 
                 active.id_active, active.name_active, active_pseudo_unit.id_pseudo_unit, active_pseudo_unit.obozn,
                 sum(spc.q1_spc) q1_spc, max(spc.price1_spc) price1_spc
            from head, spc, type_doc, active, active_pseudo_unit
           where spc.id_active = active.id_active
             and active.id_active = active_pseudo_unit.id_active
             and active_pseudo_unit.priz = 1
             and spc.id_head = head.id_head
             and head.id_type_doc = type_doc.id_type_doc
             and type_doc.id_sys = 1
             and head.accept = 1
             and head.id_client1 = ~($try (ARGUMENTS.0) $catch ('NullException') (-100000) )~
             and head.date_sd between to_date('~($try (g.n_dat1) $catch ('Any')('01.01.0001'))~', 'dd.mm.yyyy') and to_date('~($try (g.n_dat2) $catch ('Any')('01.01.0001'))~', 'dd.mm.yyyy')
           group by active.id_active, active.name_active, active_pseudo_unit.id_pseudo_unit, active_pseudo_unit.obozn
                 ) active
           order by name_active"
        editable = no
}
} // grid
}// split

{button
    left = 72  width = 50    height = 20
    BACKGROUND = "LIGHTGRAY"    foreground="#000000"
    label="Выход ESC"
   action="($self@actCancel)"
   ShortCut = "Escape"
}

{button
    left = 72  width = 50    height = 20
    BACKGROUND = "LIGHTGRAY"    foreground="#000000"
    label="Занести (Ctrl+Enter)"
   action="($self@actHok)"
   ShortCut = "Ctrl+Enter"
}

} // toolbar


