static void THK_importLedgerJournalTrans(Args _args)
{
Filename fileName = "C:\\Users\\ksiu3880\\Desktop\\GL Journal test.xlsx"; LedgerJournalId ledgerJournalId = "000425_010";
Name nameDimensionAttribute1 = "Department";
Name nameDimensionAttribute2 = "CostCenter";
Name nameDimensionAttribute3 = "ExpensePurpose"; LedgerJournalTrans_Asset ledgerJournalTrans_Asset; AxLedgerJournalTable axLedgerJournalTable;
AxLedgerJournalTrans axLedgerJournalTrans; DimensionAttributeValueSetStorage dimensionAttributeValueSetStorage; SysExcelApplication application = SysExcelApplication::construct();
SysExcelWorkbooks workbooks = application.workbooks();
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells; COMVariantType type; TransDate transDate;
LedgerJournalACType ledgerJournalACType, ledgerJournalACTypeOffset;
MainAccountNum mainAccountNum, mainAccountNumOffset;
DimensionValue dimensionValue1, dimensionValue2, dimensionValue3;
LedgerJournalTransTxt ledgerJournalTransTxt;
CurrencyCode currencyCode;
AmountCur amountCur;
ExchRate exchRate, exchRateSecond;
InvoiceId invoiceId;
DocumentDate documentDate;
DueDate dueDate;
PaymTermId paymTermId;
AssetTransTypeJournal assetTransTypeJournal;
AssetBookIdPurchSalesInvent assetBookIdPurchSalesInvent; container con, conOffset;
int numOfDimension; int row = ; setPrefix("THK_importLedgerJournalTrans"); try
{
if (!LedgerJournalTable::checkExist(ledgerJournalId))
throw Exception::Error; workbooks.open(fileName); workbook = workbooks.item();
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum();
cells = worksheet.cells(); ttsBegin; do
{
row++; print row; setPrefix(strFmt("Row %1", row)); transDate = cells.item(row, ).value().date();
mainAccountNum = strLRTrim(cells.item(row, ).value().bStr());
dimensionValue1 = strLRTrim(cells.item(row, ).value().bStr());
dimensionValue2 = strLRTrim(cells.item(row, ).value().bStr());
dimensionValue3 = strLRTrim(cells.item(row, ).value().bStr());
ledgerJournalTransTxt = strLRTrim(cells.item(row, ).value().bStr());
currencyCode = strLRTrim(cells.item(row, ).value().bStr());
amountCur = cells.item(row, ).value().double();
exchRate = cells.item(row, ).value().double();
exchRateSecond = cells.item(row, ).value().double();
invoiceId = strLRTrim(cells.item(row, ).value().bStr());
documentDate = cells.item(row, ).value().date();
dueDate = cells.item(row, ).value().date();
paymTermId = strLRTrim(cells.item(row, ).value().bStr());
assetBookIdPurchSalesInvent = strLRTrim(cells.item(row, ).value().bStr());
mainAccountNumOffset = strLRTrim(cells.item(row, ).value().bStr()); switch (strLRTrim(cells.item(row, ).value().bStr()))
{
case "Bank": ledgerJournalACType = ledgerJournalACType::Bank; break;
case "Customer": ledgerJournalACType = ledgerJournalACType::Cust; break;
case "Fixed Assets": ledgerJournalACType = ledgerJournalACType::FixedAssets; break;
case "Ledger": ledgerJournalACType = ledgerJournalACType::Ledger; break;
case "Project": ledgerJournalACType = ledgerJournalACType::Project; break;
case "Vendor": ledgerJournalACType = ledgerJournalACType::Vend; break;
default: ledgerJournalACType = ledgerJournalACType::Ledger; break;
} switch (strLRTrim(cells.item(row, ).value().bStr()))
{
case "Acquisition": assetTransTypeJournal = AssetTransTypeJournal::Acquisition; break;
case "Acquisition Adjustment": assetTransTypeJournal = AssetTransTypeJournal::AcquisitionAdj; break;
default: assetTransTypeJournal = AssetTransTypeJournal::Acquisition; break;
} switch (strLRTrim(cells.item(row, ).value().bStr()))
{
case "Bank": ledgerJournalACTypeOffset = ledgerJournalACType::Bank; break;
case "Customer": ledgerJournalACTypeOffset = ledgerJournalACType::Cust; break;
case "Fixed Assets": ledgerJournalACTypeOffset = ledgerJournalACType::FixedAssets; break;
case "Ledger": ledgerJournalACTypeOffset = ledgerJournalACType::Ledger; break;
case "Project": ledgerJournalACTypeOffset = ledgerJournalACType::Project; break;
case "Vendor": ledgerJournalACTypeOffset = ledgerJournalACType::Vend; break;
default: ledgerJournalACTypeOffset = ledgerJournalACType::Ledger; break;
} axLedgerJournalTrans = new AxLedgerJournalTrans();
con = [mainAccountNum, mainAccountNum];
conOffset = [mainAccountNumOffset, mainAccountNumOffset];
dimensionAttributeValueSetStorage = new DimensionAttributeValueSetStorage();
numOfDimension = ; if (dimensionValue1)
{
con += [nameDimensionAttribute1, dimensionValue1];
conOffset += [nameDimensionAttribute1, dimensionValue1];
numOfDimension ++; dimensionAttributeValueSetStorage.addItem(DimensionAttributeValue::findByDimensionAttributeAndValue(DimensionAttribute::findByName(nameDimensionAttribute1), dimensionValue1));
} if (dimensionValue2)
{
con += [nameDimensionAttribute2, dimensionValue2];
conOffset += [nameDimensionAttribute2, dimensionValue2];
numOfDimension ++; dimensionAttributeValueSetStorage.addItem(DimensionAttributeValue::findByDimensionAttributeAndValue(DimensionAttribute::findByName(nameDimensionAttribute2), dimensionValue2));
} if (dimensionValue3)
{
con += [nameDimensionAttribute3, dimensionValue3];
conOffset += [nameDimensionAttribute3, dimensionValue3];
numOfDimension ++; dimensionAttributeValueSetStorage.addItem(DimensionAttributeValue::findByDimensionAttributeAndValue(DimensionAttribute::findByName(nameDimensionAttribute3), dimensionValue3));
} con = conIns(con, , numOfDimension);
conOffset = conIns(conOffset, , numOfDimension); axLedgerJournalTrans.parmJournalNum(ledgerJournalId);
axLedgerJournalTrans.parmTransDate(transDate);
axLedgerJournalTrans.parmAccountType(ledgerJournalACType);
axLedgerJournalTrans.parmLedgerDimension(AxdDimensionUtil::getMultiTypeAccountId(enumNum(LedgerJournalACType), ledgerJournalACType, con));
axLedgerJournalTrans.parmTxt(ledgerJournalTransTxt);
axLedgerJournalTrans.parmCurrencyCode(currencyCode);
axLedgerJournalTrans.parmExchRate(exchRate * );
axLedgerJournalTrans.parmPaymId(num2str(exchRateSecond, , , , ));
axLedgerJournalTrans.parmInvoice(invoiceId);
axLedgerJournalTrans.parmDocumentDate(documentDate);
axLedgerJournalTrans.parmDue(dueDate);
axLedgerJournalTrans.parmPayment(paymTermId); if (ledgerJournalACType != LedgerJournalACType::Ledger)
axLedgerJournalTrans.parmDefaultDimension(dimensionAttributeValueSetStorage.save()); if (amountCur >= )
axLedgerJournalTrans.parmAmountCurDebit(amountCur);
else
axLedgerJournalTrans.parmAmountCurCredit(-amountCur); if (mainAccountNumOffset)
{
axLedgerJournalTrans.parmOffsetAccountType(ledgerJournalACTypeOffset);
axLedgerJournalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getMultiTypeAccountId(enumNum(LedgerJournalACType), ledgerJournalACTypeOffset, conOffset)); if (ledgerJournalACTypeOffset != LedgerJournalACType::Ledger)
axLedgerJournalTrans.parmOffsetDefaultDimension(dimensionAttributeValueSetStorage.save());
} axLedgerJournalTrans.save(); if (axLedgerJournalTrans.ledgerJournalTrans().isFixedAssetsTransaction())
{
ledgerJournalTrans_Asset.clear();
ledgerJournalTrans_Asset.initValue(); ledgerJournalTrans_Asset.RefRecId = axLedgerJournalTrans.ledgerJournalTrans().RecId;
ledgerJournalTrans_Asset.AssetId = axLedgerJournalTrans.ledgerJournalTrans().getAssetId();
ledgerJournalTrans_Asset.Company = axLedgerJournalTrans.ledgerJournalTrans().getAssetCompany();
ledgerJournalTrans_Asset.TransType = assetTransTypeJournal;
ledgerJournalTrans_Asset.BookId = assetBookIdPurchSalesInvent; if (!ledgerJournalTrans_Asset.validateWrite())
throw Exception::Error; ledgerJournalTrans_Asset.insert();
} type = cells.item(row + , ).value().variantType();
}
while (type != COMVariantType::VT_EMPTY); ttsCommit;
}
catch (Exception::Error)
{
} application.quit();
}

How to using to code import to GL journal[AX2012]的更多相关文章

  1. How to using x++ code create GL journal[AX2012]

    static void FAN_GLImport(Args _args) { AxLedgerJournalTable header = new AxLedgerJournalTable(); AxL ...

  2. R12: Improving Performance of General Ledger and Journal Import (Doc ID 858725.1 )

    In this Document   Purpose   Scope   Details   A) Database Init.ora Parameters   B) Concurrent Progr ...

  3. spring源码分析之@ImportSelector、@Import、ImportResource工作原理分析

    1. @importSelector定义: /** * Interface to be implemented by types that determine which @{@link Config ...

  4. Python on VS Code

    install python extension Press F1, and input "ext install python". Then the icon at the le ...

  5. 小白的Python之路 day5 python模块详解及import本质

    一.定义 模块:用来从逻辑上组织python代码(变量,函数,类,逻辑:实现一个功能) 本质就是.py结尾的python文件(文件名:test.py,对应的模块名:test) 包:用来从逻辑上组织模块 ...

  6. Spring注解之@Import

    /** * Indicates one or more {@link Configuration @Configuration} classes to import. * 表示import 一个或多个 ...

  7. python标准库介绍——30 code 模块详解

    ==code 模块== ``code`` 模块提供了一些用于模拟标准交互解释器行为的函数. ``compile_command`` 与内建 ``compile`` 函数行为相似, 但它会通过测试来保证 ...

  8. ES6中的import与export对class操作相关用法举例

    两种用法: 一.指定输出类名 // export 输出 export class App extends React.Componet { // ..code } // import 引入 impor ...

  9. 6 Easy Steps to Learn Naive Bayes Algorithm (with code in Python)

    6 Easy Steps to Learn Naive Bayes Algorithm (with code in Python) Introduction Here’s a situation yo ...

随机推荐

  1. wap资费页面

    移动网关 CMWAP 返回vnd.wap.wml 用CMWAP接入点发一个http的请求时,移动的10.0.0.172这个代理网关会回一个确认页面,中国特色.处理的办法是检测到Content-type ...

  2. HDU 4738 Caocao's Bridges

    Caocao's Bridges Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  3. 重设mysql的root密码,MAC OSX

    前些天装得mysql突然链接不上了,原谅我小白,没有在安装后改密码,mysql初始登陆不需要密码,但是之后root是有个临时密码的,然后..然后就登不上了. 网上有很多改密码的帖子,关键的UPDATE ...

  4. Cv运动分析与对象跟踪(转)

    Cv运动分析与对象跟踪   目录 [隐藏] 1 背景统计量的累积 1.1 Acc 1.2 SquareAcc 1.3 MultiplyAcc 1.4 RunningAvg 2 运动模板 2.1 Upd ...

  5. jmeter随笔(5)--断言中正则表达式的特殊字符问题和中文乱码显示问号的问题

    最近在工作中,对jmeter实践的点滴的记录,这里分享交流,不一定正确,仅供参考和讨论,有想法的欢迎留言.谈论,手机上图片如果不清晰,请点击[阅读原文]查看. 问题:今天QQ群一朋友遇到jmeter的 ...

  6. GUI创建各常用控件(二)

    继续接着上一篇! 在我看来有一点需要申明:由于是GUI的相关知识,所以我只是在复习中粗略的总结而已,因此参考价值可能有限,更多的是当作自己学习的一个记录以及便于自己查阅. 好啦!干货继续: 1.类似于 ...

  7. KVM虚拟化(一)—— 介绍与简单使用

    一.架构及介绍 KVM(Kernel-based Virtual Machine)它由 Quramnet 开发,该公司于 2008年被 Red Hat 收购: 自Linux 2.6.20后整合到内核, ...

  8. 解决visual studio已安装的问题

    使用Windows Install Clean Up(用管理员身份打开),找到相应的软件

  9. Android之Handler(异步消息处理)机制

    1. 概述 Handler . Looper .Message 这三者都与Android异步消息处理线程相关的概念.那么什么叫异步消息处理线程呢?异步消息处理线程启动后会进入一个无限的循环体之中,每循 ...

  10. .NET本质论之三(应用程序对象 )

    2.1 请求的处理参数------上下文对象HttpContext   现在,请求已经到达了ASP.NET服务器,为了处理请求,ASP.NET在服务器上创建了HttpRequest类型的对象以表示请求 ...