static void ItemId_Import(Args _args)
{
axInventTable axInventTable;
inventTable inventTable;
itemID itemID;
textBuffer tb = new textBuffer();
int cnt;
int numLines;
int c;
container inLine;
Dimension finDim;
itemType ItemType;
Dialog dialog;
DialogField dialogField,dialogdate;
Filename filename;
CommaIO io;
Container con;
Container filterCriteria;
COMVariant cOMVariant;
int i,j,k;
SysOperationProgress simpleProgress;
#avifiles
;
Dialog = new dialog();
dialogField = dialog.addField(typeId(FileNameOpen),'File Name');
filterCriteria = ['*.csv','*.csv'];//// To filter only CSV files
filterCriteria = dialog.filenameLookupFilter(filterCriteria);
dialog.run();
if(dialog.run())
fileName = dialogField.value();
info(filename);
io = new CommaIO(fileName, "r");
io.read();
io.inFieldDelimiter(";");
if(fileName)
{
simpleProgress = SysOperationProgress::newGeneral(#aviUpdate,'Importing Transactions',100);///SysProgressOperation
while((io.status()==IO_Status::Ok))
{
con = io.read();
if (conlen(con) == 6)
{
if (inventtable::exist(conPeek(con, 1)))
{
}
else
{
j++;
simpleProgress.incCount();
simpleprogress.setText(strfmt("Transaction Imported: %1",i));
sleep(10);
axInventTable = new axInventTable();
axInventTable.parmItemId(conPeek(con, 1));
axInventTable.parmItemName(conPeek(con, 2));
axInventTable.parmNameAlias(conPeek(con, 2));
axInventTable.parmItemGroupId(conPeek(con, 4));
axInventtable.parmItemType(Itemtype::Item);
axInventTable.parmModelGroupId(conPeek(con, 6));
axInventTable.parmDimGroupId(conPeek(con, 5));
//axInventTable.axInventTableModule_Sales().parmTaxItemGroupId(conPeek(inLine, 13));
//axInventTable.parmPrimaryVendorId(conPeek(inLine, 14));
//axInventTable.axInventTableModule_Purch().parmPrice(ConPeek(inLine, 15));
//Set financial dimension
//finDim[2] = conPeek(inLine, 18);
//axInventTable.parmDimension(finDim);
axInventTable.axInventTableModule_Purch().parmUnitId(conPeek(con, 3));
axInventTable.axInventTableModule_Sales().parmUnitId(conPeek(con, 3));
axInventTable.axInventTableModule_Invent().parmUnitId(conPeek(con, 3));
axInventTable.axInventItemInventSetup().axInventDim().parmInventSiteId("Utama");
axInventTable.axInventItemInventSetup().axInventDim().parmInventLocationId("GI");
axInventTable.axInventItemPurchSetup().axInventDim().parmInventSiteId("Utama");
axInventTable.axInventItemPurchSetup().axInventDim().parmInventLocationId("GI");
axInventTable.axInventItemSalesSetup().axInventDim().parmInventSiteId("Utama");
axInventTable.axInventItemSalesSetup().axInventDim().parmInventLocationId("GI");
axInventTable.axInventItemLocation().axInventDim().parmInventSiteId("Utama");
axInventTable.save();
ttsbegin;
ttscommit;
++i;
}
}
}
info(strFmt('Imported %1 Items', i));
}
}
//-Job End <--
{
axInventTable axInventTable;
inventTable inventTable;
itemID itemID;
textBuffer tb = new textBuffer();
int cnt;
int numLines;
int c;
container inLine;
Dimension finDim;
itemType ItemType;
Dialog dialog;
DialogField dialogField,dialogdate;
Filename filename;
CommaIO io;
Container con;
Container filterCriteria;
COMVariant cOMVariant;
int i,j,k;
SysOperationProgress simpleProgress;
#avifiles
;
Dialog = new dialog();
dialogField = dialog.addField(typeId(FileNameOpen),'File Name');
filterCriteria = ['*.csv','*.csv'];//// To filter only CSV files
filterCriteria = dialog.filenameLookupFilter(filterCriteria);
dialog.run();
if(dialog.run())
fileName = dialogField.value();
info(filename);
io = new CommaIO(fileName, "r");
io.read();
io.inFieldDelimiter(";");
if(fileName)
{
simpleProgress = SysOperationProgress::newGeneral(#aviUpdate,'Importing Transactions',100);///SysProgressOperation
while((io.status()==IO_Status::Ok))
{
con = io.read();
if (conlen(con) == 6)
{
if (inventtable::exist(conPeek(con, 1)))
{
}
else
{
j++;
simpleProgress.incCount();
simpleprogress.setText(strfmt("Transaction Imported: %1",i));
sleep(10);
axInventTable = new axInventTable();
axInventTable.parmItemId(conPeek(con, 1));
axInventTable.parmItemName(conPeek(con, 2));
axInventTable.parmNameAlias(conPeek(con, 2));
axInventTable.parmItemGroupId(conPeek(con, 4));
axInventtable.parmItemType(Itemtype::Item);
axInventTable.parmModelGroupId(conPeek(con, 6));
axInventTable.parmDimGroupId(conPeek(con, 5));
//axInventTable.axInventTableModule_Sales().parmTaxItemGroupId(conPeek(inLine, 13));
//axInventTable.parmPrimaryVendorId(conPeek(inLine, 14));
//axInventTable.axInventTableModule_Purch().parmPrice(ConPeek(inLine, 15));
//Set financial dimension
//finDim[2] = conPeek(inLine, 18);
//axInventTable.parmDimension(finDim);
axInventTable.axInventTableModule_Purch().parmUnitId(conPeek(con, 3));
axInventTable.axInventTableModule_Sales().parmUnitId(conPeek(con, 3));
axInventTable.axInventTableModule_Invent().parmUnitId(conPeek(con, 3));
axInventTable.axInventItemInventSetup().axInventDim().parmInventSiteId("Utama");
axInventTable.axInventItemInventSetup().axInventDim().parmInventLocationId("GI");
axInventTable.axInventItemPurchSetup().axInventDim().parmInventSiteId("Utama");
axInventTable.axInventItemPurchSetup().axInventDim().parmInventLocationId("GI");
axInventTable.axInventItemSalesSetup().axInventDim().parmInventSiteId("Utama");
axInventTable.axInventItemSalesSetup().axInventDim().parmInventLocationId("GI");
axInventTable.axInventItemLocation().axInventDim().parmInventSiteId("Utama");
axInventTable.save();
ttsbegin;
ttscommit;
++i;
}
}
}
info(strFmt('Imported %1 Items', i));
}
}
//-Job End <--
No comments:
Post a Comment