Do not let any software impress you!

Only let it convince your intellect.
Slider img 1
Do not look for a business paradise!

It is a waste of time.
Slider img 2
Only yourself can push you uphill.

There is no easy road to prizes.
Slider img 3
Productivity is the name of the game.

And you have to conquer it.
Slider img 4
As long as you understand it,

you will start to build your know-how.
Slider img 5
We can help with that.

We have the tools and the method.
Slider img 6

UOM
Equals
Main UOM
UOM
Code
Title
Accounitng Category
Supplier
Manufacturer
Purchase Price
Sale Price
Currency
Minimum Stock (Main UoM)
Categories
Minimum Order
Picture1
Picture2

Title : Good

Toolbars

call BrowseEditInsert()
call BrowseEditDoVKUp(fld_id,fld_val,key)
call BrowseEditDoVKDown(fld_id,fld_val,key)
call BrowseEditDelete()
call CloseForm(True)
call CloseForm(False)

Buttons

Fields


 (AU_GOOD_UNITMEAS.RELAT)
 (AU_UNITMEAS.CODE)
 (AU_UNITMEAS.CODE)
 (AU_GOOD_UNITMEAS.IS_MAIN)
Code (AU_GOOD.CODE)
Title (AU_GOOD.TITLE)
Accounitng Category (AU_T_GOOD.DESCR)
Supplier (AU_BUSINESS.TITLE)
Manufacturer (AU_BUSINESS.TITLE)
Purchase Price (AU_GOOD.PRICE_3)
Sale Price (AU_GOOD.PRICE_4)
Currency (AU_CURRENCY.CCODE)
Minimum Stock (Main UoM) (AU_GOOD.MIN_STOCK)
Categories ()
Minimum Order (AU_GOOD.POS_ANAPAR_PROM)
Picture1 (AU_GOOD.e_PICTURE1)
Picture2 (AU_GOOD.e_PICTURE2)


AutoScript

lib

proc Form_Start()

     f = TopForm()
     p = PByName(f,"AU_GOOD")
     t = TByName(p,"AU_GOOD")
     pu = PByName(f,"AU_GOOD_UNITMEAS")
     tu = TByName(pu,"AU_GOOD_UNITMEAS")

     task = FormTask(f)

     if (task = ptAppend) then

        mode = __params[6]

        call TEdit(t)
        call TSetFld(t,"GTYPE","Good")
        if (__activation_role <> "") then
         role_id = SelectFrom("SELECT AU_POS FROM AU_POS WHERE (POS_D='",__activation_role,"')")
         call TSetFld(t,"RESP_ROLE",role_id)
        else
         call TSetFld(t,"RESP_USER",__activation_user_id)
        endif
        call TPost(t)
        call ReLoadEditFields(f)

     endif

     start_sql "SUP_SEL" "KOSMOS"
        SELECT AU_BUSINESS.TITLE, AU_BUSINESS.AU_BUSINESS AS SUPPLIER
        FROM (AU_BUSINESS INNER JOIN AU_CATEGORY_ENT ON AU_BUSINESS.AU_BUSINESS = AU_CATEGORY_ENT.RID)
        INNER JOIN AU_CATEGORY_ITEM ON AU_CATEGORY_ENT.AU_CATEGORY_ITEM = AU_CATEGORY_ITEM.AU_CATEGORY_ITEM
        WHERE (AU_CATEGORY_ENT.TNAME='AU_BUSINESS') AND (AU_CATEGORY_ITEM.ACODE='AU_SUPPLIER')
        AND (AU_BUSINESS.TITLE LIKE :E & '%')
     end_sql
     start_sql "MAN_SEL" "KOSMOS"
        SELECT AU_BUSINESS.TITLE, AU_BUSINESS.AU_BUSINESS AS MANUFACTURER
        FROM (AU_BUSINESS INNER JOIN AU_CATEGORY_ENT ON AU_BUSINESS.AU_BUSINESS = AU_CATEGORY_ENT.RID)
        INNER JOIN AU_CATEGORY_ITEM ON AU_CATEGORY_ENT.AU_CATEGORY_ITEM = AU_CATEGORY_ITEM.AU_CATEGORY_ITEM
        WHERE (AU_CATEGORY_ENT.TNAME='AU_BUSINESS') AND (AU_CATEGORY_ITEM.ACODE='AU_MANUFACTURER')
        AND (AU_BUSINESS.TITLE LIKE :E & '%')
     end_sql

     cat = GetEditBox("GOOD_TYPE_CATEGORY")
     call SetEditBox(cat,"CATEGORY=AU_GOODTYPES")

end

proc Select_SUP_SEL_Params()

   s = GetEditedText()
   call ParamsEmbSQL("SUP_SEL";s)

end

proc Select_MAN_SEL_Params()

   s = GetEditedText()
   call ParamsEmbSQL("MAN_SEL";s)

end

{================================ Form_BeforeClose ======================================}

fun Form_BeforeClose()

    result = 1

    count = TRecordCount(tu)
    if (count = 0) then
       call message("Define Units of Meassure!")
       result = 0
       return
    endif

    main_flag = 0
    call TFirst(tu)
    for i = 1 to count
        um_id = TGetFld(tu,"AU_UNITMEAS")
        ismn = TGetFld(tu,"IS_MAIN")

        if (ismn = 1) and (um_id > 0) then
         main_flag = main_flag + 1
        endif

        call TNext(tu)
    next

    if (main_flag <> 1) then
       call message("One Main Unit of Meassure must be defined!")
       result = 0
    endif
end