zoukankan      html  css  js  c++  java
  • load mainaccount

    static

    void LoadMainAccountCSV(Args _args)

    {

           

    /*

            SysExcelApplication        excel;

            SysExcelWorkbooks      workbooks;

            SysExcelWorkbook        workbook,_workbook;

            SysExcelWorksheets    worksheets,_worksheets;

            SysExcelWorksheet      worksheet,_worksheet;

            SysExcelCells              cells,_cells;

            */

            CommaIo           csvFile;

            COMVariantType              type,_type;

           

    int                        row = 1;

            MainAccount                   _MainAccount;

            MainAccountLegalEntity        _MainAccountLegalEntity;

            FileName                      fileName;

           

    container                     readCon = conNull();

            AccountNum                 mainAccountId;

            ;

            filename =

    @'C:\COA_live.csv';

            csvFile =

    new CommaIo(filename, 'r');

            csvFile.inFieldDelimiter(

    ','); // Delimiter...

           

    /*

            #define.filename(@'C:\chartofaccount.xlsx')

            excel = SysExcelApplication::construct();

            workbooks = excel.workbooks();

            try

            {

                    workbooks.open(#filename);

            }

            catch (Exception::Error)

            {

                    throw error("File cannot be opened");

            }

            workbook      = workbooks.item(1);

            worksheets = workbook.worksheets();

            worksheet    = worksheets.itemFromNum(1);

            cells            = worksheet.cells();

            //row = row + 1;

            type = cells.item(row+1, 1).value().variantType();

            //通过循环读取导入信息

            */

           

    ttsBegin;

           

    //delete_from _MainAccount;

           

    if (csvFile)

            {

                readCon = csvFile.read();

               

    while (csvFile.status() == IO_Status::OK)

                {

                    readCon = csvFile.read();

                       

    if(conLen(readcon) < 1)

                    {

                       

    break;

                    }

                   

    if(!MainAccount::findByMainAccountId(conPeek(readCon,1)).RecId)

                    {

     

                        _MainAccount.clear();

                        _MainAccount.MainAccountId =

    conPeek(readCon,1);

                        _MainAccount.LedgerChartOfAccounts =

    5637144576;

                       

    switch(conPeek(readCon,2))

                        {

                           

    case"Total":

                                _MainAccount.Type = DimensionLedgerAccountType::Total;

                               

    break;

                           

    case"Asset":

                                _MainAccount.Type = DimensionLedgerAccountType::Asset;

                               

    break;

                           

    case"Liability":

                                _MainAccount.Type = DimensionLedgerAccountType::Liability;

                               

    break;

                           

    case"Equity":

                                _MainAccount.Type = DimensionLedgerAccountType::Equity;

                               

    break;

                           

    case"BalanceSheet":

                                _MainAccount.Type = DimensionLedgerAccountType::BalanceSheet;

                               

    break;

                           

    case"Expense":

                                _MainAccount.Type = DimensionLedgerAccountType::Expense;

                               

    break;

                           

    case"Revenue":

                                _MainAccount.Type = DimensionLedgerAccountType::Revenue;

                               

    break;

                           

    case"ProfitAndLoss":

    _MainAccount.Type = DimensionLedgerAccountType::ProfitAndLoss;

                               

    break;

                           

    case"Blank":

                                _MainAccount.Type = DimensionLedgerAccountType::Blank;

                               

    break;

                           

    case"Reporting":

                                _MainAccount.Type = DimensionLedgerAccountType::Reporting;

                               

    break;

                           

    case"Common_CN":

                                _MainAccount.Type = DimensionLedgerAccountType::Common_CN;

                               

    break;

                        }

                        _MainAccount.Name =

    conPeek(readcon,3);

                        _MainAccount.insert();

                    }

                   

    else

                    {

                        mainAccountId =

    conPeek(readCon,1);

                       

    selectforUpdate _MainAccount

                       

    where _MainAccount.MainAccountId == mainAccountId;

                       

    if(_MainAccount)

                        {

                           

    switch(conPeek(readCon,2))

                            {

                               

    case"Total":

                                    _MainAccount.Type = DimensionLedgerAccountType::Total;

                                   

    break;

                               

    case"Asset":

                                    _MainAccount.Type = DimensionLedgerAccountType::Asset;

                                   

    break;

                               

    case"Liability":

                                    _MainAccount.Type = DimensionLedgerAccountType::Liability;

                                   

    break;

                               

    case"Equity":

                                    _MainAccount.Type = DimensionLedgerAccountType::Equity;

                                   

    break;

                               

    case"BalanceSheet":

                                    _MainAccount.Type = DimensionLedgerAccountType::BalanceSheet;

                                   

    break;

                               

    case"Expense":

                                    _MainAccount.Type = DimensionLedgerAccountType::Expense;

                                   

    break;

                               

    case"Revenue":

                                    _MainAccount.Type = DimensionLedgerAccountType::Revenue;

                                   

    break;

                               

    case"ProfitAndLoss":

    _MainAccount.Type = DimensionLedgerAccountType::ProfitAndLoss;

                                   

    break;

                               

    case"Blank":

                                    _MainAccount.Type = DimensionLedgerAccountType::Blank;

                                   

    break;

                               

    case"Reporting":

                                    _MainAccount.Type = DimensionLedgerAccountType::Reporting;

                                   

    break;

                               

    case"Common_CN":

                                    _MainAccount.Type = DimensionLedgerAccountType::Common_CN;

                                   

    break;

                            }

                        }

                        _MainAccount.update();

                    }

                }

     

            }

           

    ttsCommit;

     

       

    /*

        ttsBegin;

        //delete_from _MainAccountLegalEntity;

        while select _MainAccount

        {

            _MainAccountLegalEntity.clear();

            _MainAccountLegalEntity.LegalEntity = 5637144577;

            _MainAccountLegalEntity.MainAccount = _MainAccount.RecId;

            _MainAccountLegalEntity.insert();

        }

        ttsCommit;

        */

            info(

    "ok");

    }

  • 相关阅读:
    HDU 2594 扩展kmp模板题
    HDU 1358 简单kmp
    HDU 3336 扩展kmp
    SPOJ SUBLEX 求第k小子串
    Codeforces 235C
    HDU 4622 Reincarnation
    HDU 4622 求解区间字符串中的不同子串的个数
    [LeetCode] Length of Last Word 字符串查找
    [LeetCode] Sudoku Solver 解数独,递归,回溯
    [LeetCode] Longest Common Prefix 字符串公有前序
  • 原文地址:https://www.cnblogs.com/lingdanglfw/p/4924591.html
Copyright © 2011-2022 走看看