Professional Documents
Culture Documents
JOBIMportacao
JOBIMportacao
{
FiscalDocument_BR fiscalDocument;
VendInvoiceJour vendInvoiceJour;
PurchTable purchTable;
HAKPurchTable hakPurchTable;
int i;
str invoice, series, accessKey, establishment;
PurchId purchId;
ModelId model;
#File
IO iO;
FilenameOpen filename = @"C:\GSW\Import\OC.csv";
Container record;
iO = new CommaTextIo(filename,#IO_Read);
if (! iO || iO.status() != IO_Status::Ok)
{
throw error("@SYS19358");
}
if (record)
{
i++;
if (i > 1)
{
invoice = strLRTrim(conPeek(record, 1));
//model = strLRTrim(conPeek(record, 2));
//series = strLRTrim(conPeek(record, 3));
accessKey = strLRTrim(conPeek(record, 4));
//establishment = strLRTrim(conPeek(record, 5));
purchId = strLRTrim(conPeek(record, 7));
if (purchTable)
{
purchTable.AccessKey_BR = strLRTrim(conPeek(record, 4));
fiscalDocument.AccessKey = strLRTrim(conPeek(record, 4));
ttsBegin;
purchTable.doUpdate();
fiscalDocument.doUpdate();
ttsCommit;