28 Kasım 2019 Perşembe

Aktif olmayan kullanıcıların gruplardan çıkarılması | Microsoft Dynamics Ax

Akfit olmayan kullanıcılar;

Aktifliği kaldırılmış olan(
UserInfo.enable == false
) kullanıcıların gruplardan kaldırılması için aşağıdaki kodu kullanabilirsiniz.

public void initValue()
{
    static void _removeDisableUserFromList(Args _args)
{
    UserGroupInfo       UserGroupInfo;
    UserGroupList       UserGroupList;
    UserInfo            UserInfo;
    UserGroupId         tmpGroupId;
    ;
    ttsbegin;
    while select forupdate UserGroupList
        join UserGroupInfo
        where UserGroupInfo.Id == UserGroupList.groupId
        //&& UserGroupInfo.id == "000-04"
    {
        while select  UserInfo
            where  UserInfo.id == UserGroupList.userId && UserInfo.enable == false
        {
            info(strfmt("%1; %2; %3", UserGroupList.groupId, UserGroupList.userId, UserInfo.name));
            UserGroupList.delete();
        }
    }
    ttscommit;

}

InventTrans | InventPostingTrans | LedgerTrans ilişkileri > Dynamics Ax

InventTrans | InventTransPosting | LedgerTrans ilişkileri 

- InventTrans (Madde hareketleri)
- InventTransPosting (Stok hareketi deftere nakil)
- LedgerTrans (Genel muhasebe hareketleri)

  1. Madde kartı kullanıldığında, InventTrans'a kayıt oluşur. (hareketleri için bu yazıyı okuyabilirsiniz)
  2. Oluşan hareket Sevk irsaliyesi kesildiğinde ilgili tablolara kayıt atar. (bu yazıyı inceleyebilirsiniz
  • InventTrans
  • VendPackingSlipJour
  • VendPackingSlipTrans
  • InventSum (Stoğa girer)
  • InventTransPosting (Kayıt LedgerTransta oluşmaz, Fiziksel deftere nakil olmuştur)

     3. Faturalandığında artık muhasebe kayıtları da oluşmuş olacaktır.
  • InventTrans
  • VendInvoiceJour
  • VendInvoiceTrans
  • LedgerTrans (Genel muhasebe hesaplarına kayıt atar)
  • TaxTrans (Vergilendirilmesi hesaplanır)
  • InventTransPosting(Mali olarak da nakil oluşturuldu)

Invent Trans & InventTransPosting & LedgerTrans arasındaki ilişki


 InventTrans  InventTransPosting LedgerTrans
 Voucher  Voucher  Voucher
 InventTransId  InventTransId
 DateFinancial  TransDate  TransDate

İrsaliye kesildi sonra nakil edildi.
Örnek olması için aşağıdaki bağlantıdan;

Stok haretlerini inceleyebilirsiniz.

Satınalma siparişi oluşturulması > Faturalanma Süreci | Dynamics Axapta

Satınalma siparişi oluşturulup > İrsaliye Kesildiğinde > Faturalandığında oluşan kayıtlar

Sipariş oluşturulduğunda madde kartı için Ax aşağıdaki tablolarda kayıt oluşturur.
  • PurchLine
  • InventTrans

Bu  kayıtlar için İrsaliye kesildiğinde;

  • InventTrans
  • VendPackingSlipJour
  • VendPackingSlipTrans
  • InventSum
  • InventTransPosting

İrsaliyelerin Faturası kesildiğinde; 

  • InventTrans
  • VendInvoiceJour
  • VendInvoiceTrans
  • LedgerTrans
  • TaxTrans
  • InventTransPosting

Tablolarında kayıt oluşur.

Hareketleri incelemek için bu yazıyı inceleyebilirsiniz.

Stok Yönetimi > Karantina Emirleri | Dynamics Axapta

Karantina Emirleri

Madde kartının Karantina Emirlerinde kayıt oluşturulması/oluşturulmaması için;

Madde ayrıntıları > Stok Modeli Grubu > Kurulum > Karantina Yönetimi alanı seçili(tikli) olduğunda ilgili kart nakil işlemleri sırasında Karantina Emirlerine başlatıldı durumunda kayıt oluşturur.


 Madde ayrıntıları > Stok Modeli Grubu > Kurulum > Karantina Yönetimi alanı tiksiz olursa,
Kantinaya kayıt oluşturmaz.

8 Kasım 2019 Cuma

Satınalma siparişlerini toplu aktarma | Sipariş satırı, Dynamics Ax

Satınalma sipariş satırlarını toplu aktar

Siparişlerin satırlarını toplu aktarmak için aşağıdaki kodu kullanabilirsiniz.

  void MAA_Excel_PurchLine()
{
    #Excel
    #AviFiles

    Dialog              dialog = new Dialog("Veri Aktarma");
    DialogField         dialogPath;
    FilenameFilter      filter = ['Excel files 2010','*.xlsx','Excel files 2003', '*.xls' ];
    FilenameOpen        filePath;
    SysExcelApplication application;
    SysExcelWorkBooks   workBooks;
    SysExcelWorkBook    workBook;
    SysExcelWorkSheets  workSheets;
    SysExcelWorkSheet   workSheet;
    SysExcelCells       cells;
    SysOperationProgress progress;
    Int                 NoofSheet,i,lastRow,sn;
  
    PurchLine            PurchLine;
    InventDim            tmpInventDim,tmpInventDimItem;
    inventBatch          inventBatch;
    InventSerial         InventSerial;

    SysExcelRange range;

    void findLastRow(SysExcelWorkSheet _workSheet)
    {
        #define.Star('*')
        #define.Space(' ')

        ;

        range = _workSheet.cells().range(#ExcelTotalRange);

        try
        {
            range = range.find(#Star, null, #xlFormulas, #xlWhole, #xlByRows, #xlPrevious);
        }
        catch (Exception::Error)
        {
            error("@SYS59926");
        }

        if (range)
        {
            lastRow = range.row();
        }
        else
        {
            lastRow = 0;
        }
    }
    ;

    dialog.filenameLookupFilter(filter);
    dialogPath  = dialog.addField(typeid(FilenameOpen));


    if (dialog.run())
    {
        if(dialog.closedOk())
        {
            filePath            = dialogPath.value();
            application         = SysExcelApplication::construct();
            application.visible(false);
            workBooks           = application.workbooks();
            workBooks.open(filePath,0,true);

            workSheets          = workBooks.item(1).worksheets();
            noOfSheet           = worksheets.count();
            progress = new SysOperationProgress();
            progress.setCaption("Vendor Importing");
            progress.setTotal(lastRow);
            progress.setAnimation(#AviTransfer);
            setprefix("Vendor Import");

            try
            {
                For( i = 1; i <= noOfSheet; i++)
                {
                    workSheet       = workSheets.itemFromNum(i);
                    if(workSheet)
                    {
                        findLastRow(workSheet);
                        for(sn = 2;sn <= lastrow;sn++)
                        {
                            ttsbegin;
                            cells                   = workSheet.cells();
                            cells = workSheet.cells();

                            PurchLine.clear();

                            PurchLine.PurchId                 = cells.item(sn,1).value().bStr();
                            PurchLine.VendAccount             = cells.item(sn,2).value().bStr();
                            PurchLine.ItemId                  = cells.item(sn,3).value().bStr();
                            PurchLine.PurchQty                = cells.item(sn,4).value().double();
                            PurchLine.PurchPrice              = cells.item(sn,5).value().currency();
                            PurchLine.LineAmount              = PurchLine.PurchQty * PurchLine.PurchPrice;
                            PurchLine.TaxItemGroup            = cells.item(sn,6).value().bStr();
                            PurchLine.VendGroup               = "272101";
                            PurchLine.TaxGroup                = "YURTICI";
                            PurchLine.CurrencyCode            =  "EUR";
                            PurchLine.ETGInventType           = InventTable::find(PurchLine.ItemId).ETGInventType;
                            PurchLine.PurchUnit               = InventTable::find(InventTableModule::find(PurchLine.ItemId, ModuleInventPurchSales::Purch).ItemId).purchUnitId();
                            PurchLine.PurchaseType            = PurchaseType::Purch;


                           //  tmpInventDimItem.clear();
                           //  tmpInventDimItem                 = purchLine.inventDim();
                           //  tmpInventDimItem                    = InventDim::findOrCreate(tmpInventDimItem);


                            if ( InventSite::exist(cells.item(sn,7).value().bStr()) )
                                tmpInventDimItem.InventSiteId       = cells.item(sn,7).value().bStr();

                            if ( InventLocation::exist(cells.item(sn,8).value().bStr()) )
                                tmpInventDimItem.InventLocationId   = cells.item(sn,8).value().bStr();

                                 purchLine.InventDimId             = cells.item(sn,9).value().bStr();




                            PurchLine.RemainPurchPhysical    = PurchLine.PurchQty;
                            PurchLine.RemainInventPhysical   = PurchLine.PurchQty;
                            PurchLine.QtyOrdered             = PurchLine.PurchQty;


                            if(Dimensions::exist(SysDimension::Department,cells.item(sn,10).value().bStr()) && cells.item(sn,10).value().bStr())
                            {
                                PurchLine.Dimension[1]   = cells.item(sn,10).value().bStr();
                                //  DRT MK - KDV hesaplaması için 
                            }
                            else if(cells.item(sn,10).value().bStr())
                                throw error(strfmt("%1 - %2 boyutu tanımlı değildir", SysDimension::Department, cells.item(sn,10).value().bStr()));

                            if(Dimensions::exist(SysDimension::Center,cells.item(sn,11).value().bStr()))
                                PurchLine.Dimension[2]   = cells.item(sn,11).value().bStr();
                            else if(cells.item(sn,11).value().bStr())
                                throw error(strfmt("%1 - %2 boyutu tanımlı değildir", SysDimension::Center, cells.item(sn,11).value().bStr()));

                            if(Dimensions::exist(SysDimension::Purpose,cells.item(sn,12).value().bStr()))
                                PurchLine.Dimension[3]   = cells.item(sn,12).value().bStr();
                            else if(cells.item(sn,12).value().bStr())
                                throw error(strfmt("%1 - %2 boyutu tanımlı değildir", SysDimension::Purpose, cells.item(sn,12).value().bStr()));

                            if(Dimensions::exist(SysDimension::Person,cells.item(sn,13).value().bStr()))
                                PurchLine.Dimension[4]   = cells.item(sn,13).value().bStr();
                            else if(cells.item(sn,13).value().bStr())
                                throw error(strfmt("%1 - %2 boyutu tanımlı değildir", SysDimension::Person, cells.item(sn,13).value().bStr()));

                            if(Dimensions::exist(SysDimension::Vehicle,cells.item(sn,14).value().bStr()))
                                PurchLine.Dimension[5]   = cells.item(sn,14).value().bStr();
                            else if(cells.item(sn,14).value().bStr())
                                throw error(strfmt("%1 - %2 boyutu tanımlı değildir", SysDimension::Vehicle, cells.item(sn,14).value().bStr()));



                            PurchLine.insert();
                            info("Aktarma tamamlandı");

                            ttscommit;
                        }
                    }
                }
            }
            catch
            {
                ttsabort;
                application.quit();
            }
        }
    }
}

Kullandığım exel şablonunu inceleyebilirsiniz. Excel Şablonu

Satınalma siparişlerini toplu aktarma | Sipariş başlığı, Dynamics Ax

Satınalma siparişleri toplu aktarma

Siparişlerin başlıklarını toplu aktarmak için aşağıdaki kodu kullanabilirsiniz.

  void MAA_Excel_PurchTable() // DRT_PasswordTable
{
    #Excel
    #AviFiles

    Dialog              dialog = new Dialog("Veri Aktarma");
    DialogField         dialogPath;
    FilenameFilter      filter = ['Excel files 2010','*.xlsx','Excel files 2003', '*.xls' ];
    FilenameOpen        filePath;
    SysExcelApplication application;
    SysExcelWorkBooks   workBooks;
    SysExcelWorkBook    workBook;
    SysExcelWorkSheets  workSheets;
    SysExcelWorkSheet   workSheet;
    SysExcelCells       cells;
    SysOperationProgress progress;
    Int                 NoofSheet,i,lastRow,sn;

    PurchTable            PurchTable;

    SysExcelRange range;

    void findLastRow(SysExcelWorkSheet _workSheet)
    {
        #define.Star('*')
        #define.Space(' ')

        ;

        range = _workSheet.cells().range(#ExcelTotalRange);

        try
        {
            range = range.find(#Star, null, #xlFormulas, #xlWhole, #xlByRows, #xlPrevious);
        }
        catch (Exception::Error)
        {
            error("@SYS59926");
        }

        if (range)
        {
            lastRow = range.row();
        }
        else
        {
            lastRow = 0;
        }
    }
    ;

    dialog.filenameLookupFilter(filter);
    dialogPath  = dialog.addField(typeid(FilenameOpen));


    if (dialog.run())
    {
        if(dialog.closedOk())
        {
            filePath            = dialogPath.value();
            application         = SysExcelApplication::construct();
            application.visible(false);
            workBooks           = application.workbooks();
            workBooks.open(filePath,0,true);

            workSheets          = workBooks.item(1).worksheets();
            noOfSheet           = worksheets.count();
            progress = new SysOperationProgress();
            progress.setCaption("Vendor Importing");
            progress.setTotal(lastRow);
            progress.setAnimation(#AviTransfer);
            setprefix("Vendor Import");

            try
            {
                For( i = 1; i <= noOfSheet; i++)
                {
                    workSheet       = workSheets.itemFromNum(i);
                    if(workSheet)
                    {
                        findLastRow(workSheet);
                        for(sn = 2;sn <= lastrow;sn++)
                        {
                            ttsbegin;
                            cells                   = workSheet.cells();
                            cells = workSheet.cells();


                            PurchTable.PurchId                 = cells.item(sn,1).value().bStr();
                            PurchTable.OrderAccount            = cells.item(sn,2).value().bStr();
                            PurchTable.InvoiceAccount          = cells.item(sn,4).value().bStr();
                            PurchTable.CurrencyCode            = cells.item(sn,5).value().bStr();
                            PurchTable.PaymMode                = cells.item(sn,10).value().bStr();
                            PurchTable.FixedDueDate            = cells.item(sn,9).value().date();
                            PurchTable.PostingProfile          = "320";
                            PurchTable.PurchPlacer             = "2524";
                            PurchTable.PurchName               = VendTable::find(PurchTable.OrderAccount).Name;
                            PurchTable.VendGroup               = VendTable::find(PurchTable.OrderAccount).VendGroup;
                            PurchTable.InventSiteId            = VendTable::find(PurchTable.OrderAccount).InventSiteId;
                            PurchTable.InventLocationId        = VendTable::find(PurchTable.OrderAccount).InventLocation;
                            PurchTable.PurchaseType            = PurchaseType::Purch;
                            PurchTable.DlvCountryRegionId      = VendTable::find(PurchTable.OrderAccount).CountryRegionId;
                            PurchTable.TaxGroup                = VendTable::find(PurchTable.OrderAccount).TaxGroup;
                            PurchTable.DeliveryAddress         = VendTable::find(PurchTable.OrderAccount).Address;
                            PurchTable.Email                   = VendTable::find(PurchTable.OrderAccount).Email;
                            PurchTable.LanguageId              = VendTable::find(PurchTable.OrderAccount).LanguageId;
                            PurchTable.DlvState                = VendTable::find(PurchTable.OrderAccount).State;
                            PurchTable.VATNum                  = VendTable::find(PurchTable.OrderAccount).VATNum;

                            PurchTable.insert();
                            info("Aktarma tamamlandı");

                            ttscommit;
                        }
                    }
                }
            }
            catch
            {
                ttsabort;
                application.quit();
            }
        }
    }
}     

Kullandığım exel şablonunu inceleyebilirsiniz. Excel Şablonu
Satırların aktarımı için bu yazıyı inceleybilirsiniz.

Total ciro

static void MAA_SalesTableTotal(Args _args) { SalesTable SalesTable; utcDateTime dateTime; dateTime ...