lingdanglfw(DAX)

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

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");

}

posted on   lingdanglfw  阅读(245)  评论(0编辑  收藏  举报

编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示