static void Dipl_ProjectDetails(Args _args)
{
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
SysExcelCell cell;
SysExcelFont font;
int row;
str type;
ProjTable projTable;
ProjGroup projGroup;
ProjPosting projPosting;
DimensionAttributeValueCombination dimensionAttributeValueCombination;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
workbook = workbooks.add();
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
cells.range('A:A').numberFormat('@');
// intializing classes to export excel
// Setting Header values
cell = cells.item(1, 1);
cell.value('ProjectId');
font = cell.font();
font.bold(true);
cell = cells.item(1, 2);
cell.value('Project Name');
font = cell.font();
font.bold(true);
cell = cells.item(1, 3);
cell.value('Project Group');
font = cell.font();
font.bold(true);
cell = cells.item(1, 4);
cell.value('project Type');
font = cell.font();
font.bold(true);
cell = cells.item(1, 5);
cell.value('Cost Account');
font = cell.font();
font.bold(true);
cell = cells.item(1, 6);
cell.value('Revenue Account');
font = cell.font();
font.bold(true);
row = 1;
while select projTable
join projGroup
where projGroup.ProjGroupId == projTable.ProjGroupId
join ProjPosting
where ProjPosting.ProjCode == 1
&& ProjPosting.ProjRelation == projGroup.ProjGroupId
join dimensionAttributeValueCombination
where dimensionAttributeValueCombination.RecId == ProjPosting.LedgerDimension
{
row++;
type = enum2str(projTable.Type);
cell = cells.item(row, 1);
cell.value(projTable.ProjId);
cell = cells.item(row, 2);
cell.value(projTable.Name);
cell = cells.item(row, 3);
cell.value(projTable.ProjGroupId);
cell = cells.item(row, 4);
cell.value(type);
if(ProjPosting.RecId && ProjPosting.ProjAccountType == ProjAccountType::CostAccount)
{
cell = cells.item(row, 5);
cell.value(dimensionAttributeValueCombination.DisplayValue);
}
else if(ProjPosting.RecId && ProjPosting.ProjAccountType == ProjAccountType::RevenueAccount)
{
cell = cells.item(row, 6);
cell.value(dimensionAttributeValueCombination.DisplayValue);
}
}
application.visible(true);
}
{
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
SysExcelCell cell;
SysExcelFont font;
int row;
str type;
ProjTable projTable;
ProjGroup projGroup;
ProjPosting projPosting;
DimensionAttributeValueCombination dimensionAttributeValueCombination;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
workbook = workbooks.add();
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
cells.range('A:A').numberFormat('@');
// intializing classes to export excel
// Setting Header values
cell = cells.item(1, 1);
cell.value('ProjectId');
font = cell.font();
font.bold(true);
cell = cells.item(1, 2);
cell.value('Project Name');
font = cell.font();
font.bold(true);
cell = cells.item(1, 3);
cell.value('Project Group');
font = cell.font();
font.bold(true);
cell = cells.item(1, 4);
cell.value('project Type');
font = cell.font();
font.bold(true);
cell = cells.item(1, 5);
cell.value('Cost Account');
font = cell.font();
font.bold(true);
cell = cells.item(1, 6);
cell.value('Revenue Account');
font = cell.font();
font.bold(true);
row = 1;
while select projTable
join projGroup
where projGroup.ProjGroupId == projTable.ProjGroupId
join ProjPosting
where ProjPosting.ProjCode == 1
&& ProjPosting.ProjRelation == projGroup.ProjGroupId
join dimensionAttributeValueCombination
where dimensionAttributeValueCombination.RecId == ProjPosting.LedgerDimension
{
row++;
type = enum2str(projTable.Type);
cell = cells.item(row, 1);
cell.value(projTable.ProjId);
cell = cells.item(row, 2);
cell.value(projTable.Name);
cell = cells.item(row, 3);
cell.value(projTable.ProjGroupId);
cell = cells.item(row, 4);
cell.value(type);
if(ProjPosting.RecId && ProjPosting.ProjAccountType == ProjAccountType::CostAccount)
{
cell = cells.item(row, 5);
cell.value(dimensionAttributeValueCombination.DisplayValue);
}
else if(ProjPosting.RecId && ProjPosting.ProjAccountType == ProjAccountType::RevenueAccount)
{
cell = cells.item(row, 6);
cell.value(dimensionAttributeValueCombination.DisplayValue);
}
}
application.visible(true);
}
No comments:
Post a Comment