Sunday, 3 November 2019

Runnable class to set current fiscal year to Calendar Field in Asset book

class SetCalendarToFixedAssetBooks
{
    public static void main(Args _args)
    {
        AssetBookTable assetBookTable1,assetBookTable2;
        AssetBookId book1,book2;
        book1='AMT';
        book2='FED';
       
        RecId FiscalYearRecId = Ledger::FiscalCalendar();
        if(Box::okCancel('Set current Fiscal Year to Asset Books with BookIds- AMT & FED ?',DialogButton::Cancel) == DialogButton::Ok)
        {
            ttsbegin;

            select  forupdate assetBookTable1 where assetBookTable1.BookId == book1;
            select  forupdate assetBookTable2 where assetBookTable2.BookId == book2;


            if(assetBookTable1)
            {
                assetBookTable1.FiscalCalendar = FiscalYearRecId;
                assetBookTable1.update();
                info(strFmt("Calendar set for AssetBook with BookId %1", book1));
            }

           
            if(assetBookTable2)
            {
                assetBookTable2.FiscalCalendar = FiscalYearRecId;
                assetBookTable2.update();
                info(strFmt("Calendar set for AssetBook with BookId %1", book2));
            }
            ttscommit;
        }
    }

}

1 comment:

  1. Do you need Finance? Are you looking for Finance? Are you looking for finance to enlarge your business? We help individuals and companies to obtain finance for business expanding and to setup a new business ranging any amount. Get finance at affordable interest rate of 3%, Do you need this finance for business and to clear your bills? Then send us an email now for more information contact us now via (financialserviceoffer876@gmail.com) whats-App +918929509036 Dr James Eric Finance Pvt Ltd Thanks

    ReplyDelete