2012-03-31

[AX2009] Export Import User Group Security

Export security setting dari current AOS:
  1. Administration»Periodic
  2. Data export/import
  3. Fokus ke Definition groups
  4. Input Definition group.
  5. Input Definition group name.
  6. Pilih Standard sebagai Type nya.
  7. Klick Options tab
  8. Cek "Include system tables" checkbox (system tables).
  9. Klik tombol Table setup.
  10. Masukkan daftar tabel:
    1. AccessRightsList* - menyimpan security permissions untuk User groups
    2. UserGroupInfo* - menyimpan User groups
    3. DomainInfo* - menyimpan Domains
    4. UserGroupList - menyimpan anggota User group
    5. UserInfo - menyimpan User AX
    6. SysUserInfo - menyimpan User AX setting.
    7. CompanyDomainList - menyimpan keterhubungan company/domain
  11. Klik tombol Export to.
  12. Pilih lokasi, nama, dan simpan filenya (.dat).
  13. OK
Import ke target AOS:
  1. Administration»Periodic
  2. Buka Data export/import
  3. Pilih Import
  4. Pilih Definition group atau kosongkan saja.
  5. Pilih file .dat yang sudah diexport td.
  6. Ok
Sumber: MSDN

2012-03-16

Function monthDiff

Mencari rentang/jumlah bulan dari suatu periode. Masih mencari function terbaik.
int monthDiff(TransDate _fromDate, TransDate _toDate)
{
    TransDate   fromDate = _fromDate, toDate = _toDate;
    int         yrDiff;
    int         totalMonth;
    int         fdtDay = dayofmth(fromDate);
    //int         tdtDay = dayofmth(toDate);
    int         frMth = mthofyr(fromDate);
    int         toMth = mthofyr(toDate);
    int         countMth;
    int         fYear = year(fromDate), tYear = year(toDate);
    date        procDt;
    ;
    yrDiff = yearDiff(toDate, fromDate);

    countMth = frMth;
    totalMonth = 0;

    if(!yrDiff)
    {
        while(fYear<=tYear)
        {
            while(countMth<=12)
            {
                if((fYear == tYear) && (countMth == toMth))
                    break;

                countMth++;
                totalMonth++;
            }
            fYear++;
            countMth = 1;
        }
    }
    else
    {
        tYear = tYear - yrDiff;

        while(fYear<=tYear)
        {
            while(countMth<=12)
            {
                if((fYear == tYear) && (countMth == toMth))
                    break;

                countMth++;
                totalMonth++;
            }
            fYear++;
            countMth = 1;
        }
        totalMonth += (12 * yrDiff);
    }
    procDt =  mkdate(fdtDay,toMth,fYear-1);
    if(!(dayofmth(procDt)<fdtDay))
        procDt--;

    if(toDate<(procDt))
        totalMonth--;
    
    fYear = year(fromDate);
    if(fYear == tYear && frMth == toMth && fromDate == dateStartMth(fromDate) && toDate == dateEndMth(toDate))
        totalMonth++;

     return totalMonth;
}