static void Job39(Args _args)
{
Dialog _dialog;
DialogField _file;
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
PurchTable PurchTable;
PurchLine PurchLine;
Name name;
Filename filename;
str journalName;
str 50 POOrders;
int row;
;
row =1;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
//specify the file path that you want to read
//Prompt to import excel
_dialog = new Dialog("Please select the file to load");
_dialog.addText("Select file:");
_file =_dialog.addField(extendedTypeStr(FilenameOpen));
_dialog.run();
if (_dialog.closedOK())
{
filename = _file.value();
try
{
workbooks.open(filename);
}
catch (Exception::Error)
{
throw error("File cannot be opened.");
}
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1); //Here 3 is the worksheet Number
cells = worksheet.cells();
do
{
row++;
POOrders = cells.item(row, 1).value().bStr();
ttsBegin;
select forUpdate PurchTable where PurchTable.PurchId== POOrders;//"000013";
{
while select forUpdate PurchLine where PurchLine.PurchId == PurchTable.PurchId
{
PurchLine.doDelete();
}
PurchTable.doDelete();
}
ttsCommit;
// Loads the next row into the variant type and validating that its is empty or not
type = cells.item(row+1, 1).value().variantType();
}
while (type != COMVariantType::VT_EMPTY);
application.quit();
}
}
{
Dialog _dialog;
DialogField _file;
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
PurchTable PurchTable;
PurchLine PurchLine;
Name name;
Filename filename;
str journalName;
str 50 POOrders;
int row;
;
row =1;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
//specify the file path that you want to read
//Prompt to import excel
_dialog = new Dialog("Please select the file to load");
_dialog.addText("Select file:");
_file =_dialog.addField(extendedTypeStr(FilenameOpen));
_dialog.run();
if (_dialog.closedOK())
{
filename = _file.value();
try
{
workbooks.open(filename);
}
catch (Exception::Error)
{
throw error("File cannot be opened.");
}
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1); //Here 3 is the worksheet Number
cells = worksheet.cells();
do
{
row++;
POOrders = cells.item(row, 1).value().bStr();
ttsBegin;
select forUpdate PurchTable where PurchTable.PurchId== POOrders;//"000013";
{
while select forUpdate PurchLine where PurchLine.PurchId == PurchTable.PurchId
{
PurchLine.doDelete();
}
PurchTable.doDelete();
}
ttsCommit;
// Loads the next row into the variant type and validating that its is empty or not
type = cells.item(row+1, 1).value().variantType();
}
while (type != COMVariantType::VT_EMPTY);
application.quit();
}
}
No comments:
Post a Comment