Opening Balance
期初余额导入
GL:总帐
static void ImportTBGL(Args _args)
{
AsciiIo csvFile;
container record;
int numImported,lineNo;
AxLedgerJournalTable axLedgerJournalTable;
AxLedgerJournalTrans axLedgerJournalTrans;
;
csvFile = new AsciiIo("C:\\Users\\zhaoqiang\\Desktop\\DataImportTemplate_DynamicData\\CSAG_GL.csv","R");
csvFile.inFieldDelimiter(",");
if ( (!csvFile)||(csvFile.status() != IO_Status::Ok))
{
warning("Error in cvs file!!");
throw(Exception::Error);
}
try
{
axLedgerJournalTable = new AxLedgerJournalTable();
axLedgerJournalTable.parmJournalName("FIOpening");
axLedgerJournalTable.parmName("TB GL 20190831");
axLedgerJournalTable.save();
numImported = 0;
lineNo = 1;
record = csvFile.read();
while (csvFile.status() == IO_Status::Ok)
{
record = csvFile.read();
lineNo = lineNo +1;
if (!record) break;
ttsBegin;
if (conPeek(record,1)!="")
{
axLedgerJournalTrans = new AxLedgerJournalTrans();
axLedgerJournalTrans.parmJournalNum(axLedgerJournalTable.ledgerJournalTable().JournalNum);
//axLedgerJournalTrans.parmVoucher(NumberSeq::newGetVoucherFromCode("FIOPV_SG").voucher());
axLedgerJournalTrans.parmTransDate(str2Date("2019/8/31",321));
axLedgerJournalTrans.parmTxt("TBGL20190831");
axLedgerJournalTrans.parmAccountType(LedgerJournalACType::Ledger);
axLedgerJournalTrans.parmAccountNum(conPeek(record,1));
axLedgerJournalTrans.parmCurrencyCode(conPeek(record,2));
if (str2num(conPeek(record,3)) > 0)
{
axLedgerJournalTrans.parmAmountCurDebit(str2num(conPeek(record,3)));
} else
{
axLedgerJournalTrans.parmAmountCurCredit(abs(str2num(conPeek(record,3))));
}
axLedgerJournalTrans.parmExchRate(round(conPeek(record,4),0.0001));
axLedgerJournalTrans.parmOffsetAccountType(LedgerJournalACType::Ledger);
axLedgerJournalTrans.parmOffsetAccount("9999");
axLedgerJournalTrans.save();
numImported = numImported + 1;
} else
{
info(strfmt("line No -- %1 -- has no accountNum, not imported",lineNo));
}
ttsCommit;
} //while
}
catch(Exception::Error)
{
throw(exception::Error);
}
info(strfmt("%1 records imported",numImported));
}AP:应付账款
AR/OR:应收账款,其他应收款
AR和OR使用同一份模板, OR: other
INVENTORY:存货
导入存货的时候需要注意把序列号一并导入(如果有)
FA:固定资产
Fixed Assets 包括了固定资产卡片、购置、折旧,使用同一个模板用如下程序导入三次即可。
程序代码
数据模板
Last updated
Was this helpful?