Extracting Excel reports from Dynamics AX 2009 is easier task but client ask for formatted reports developers face a problem in generating a report directly in excel as per client requirement as:
1. Borders
2. interiors
3. Bold/Italic header
4. image in excel
5. Fonts
6. Underline
Below class can be used to generate the reports copy the code in text file and save in xpo import the file in Dynamics AX 2009
Exportfile for AOT version 1.0 or later
Formatversion: 1
***Element: CLS
; Microsoft Dynamics AX Class: S3AttendanceDetailsReport unloaded
; --------------------------------------------------------------------------------
CLSVERSION 1
CLASS #S3AttendanceDetailsReport
PROPERTIES
Name #S3AttendanceDetailsReport
Extends #RunBase
RunOn #Called from
ENDPROPERTIES
METHODS
Version: 3
SOURCE #calcBonusAmount
#void calcBonusAmount(int _month)
#{
# /* str leftDatestr;
# ;
# //TODO start calc the left date.
# leftDate = today();
# leftDatestr = date2str(leftDate,123,2,DateSeparator::Slash,2,DateSeparator::Slash,4);
# //TODO End calc the left date.
#
# this.incrementColumn(_month);
# this.xlInsert(types::String, row, column,"'"+int2Str(bonusAmount));
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
#
# this.incrementColumn(16);
# this.xlInsert(types::String, row, column,"'"+int2Str(totalBonusAmount));
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
#
# this.incrementColumn();
# this.xlInsert(types::String, row, column,leftDatestr);
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
#
# ColChar2 = this.getColChar(column);
# ColRow2 = strfmt('%1%2',ColChar2,row);
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));*/
#
#}
ENDSOURCE
SOURCE #calcMonthlyBonus
#public void calcMonthlyBonus(EmplTable _emplTable)
#{
# // SPLPaySalaryTrans paySalaryTrans;
# // TransDate yearStart;
# // TransDate yearEnd;
# // int incrementColumn;
# ;
# // totalBonusAmount = 0;
# // yearStart = DateStartMth(fromDate);
# // yearEnd = DateEndMth(todate);
#
# /* if(SPLPayReportParameters::find().BonusHead)
# {
# while select paysalaryTrans where paySalaryTrans.EmplId == _emplTable.EmplId
# && paySalaryTrans.SalaryMonth >= yearStart
# && paysalarytrans.SalaryMonth <= yearEnd
# && paySalaryTrans.HeadId == SPLPayReportParameters::find().BonusHead
# {
# incrementColumn = this.getColCharForMonth(mthofyr(paysalarytrans.SalaryMonth));
# bonusAmount = paySalaryTrans.AmountCur;
# totalBonusAmount += bonusAmount;
# this.calcBonusAmount(incrementColumn);
# }
#
# }
# else
# throw error("please select bonus head in report parameter");*/
#
#}
ENDSOURCE
SOURCE #canGoBatch
#public boolean canGoBatch()
#{
# return false;
#}
ENDSOURCE
SOURCE #caption
#public ClassDescription caption()
#{
# ClassDescription ret;
# ret = "Daily Attendance Report";
# return ret;
#}
ENDSOURCE
SOURCE #classDeclaration
#class S3AttendanceDetailsReport extends Runbase
#{
#
# int row;
# int column;
#
# str ColChar;
# str ColRow ;
#
# str ColChar1;
# str ColRow1 ;
# str ColChar2;
# str ColRow2 ;
# COM excelApplication;
# COM excelWorkBooks;
# COM excelWorkBook;
# COM excelWorkSheets;
# COM excelWorkSheet;
# COM excelCell;
# COM range;
# COM Borders;
# COM Border;
# COM font;
# COM entireColumn;
# COM ColoumnWidth;
# FileNameSave fileNameSave;
# DialogField fileName;
# int serNo;
#
# TransDate fromDate;
# TransDate toDate;
# DialogField fromDateField;
# DialogField toDateField;
# Emplid emplid;
# Name name;
# Description departmentDescription;
# EmplTable emplTable;
# Name relationName;
# QueryRun queryRun;
# TransDate leftDate;
# COM styles;
# S3AttendanceDetails S3AttendanceDetails1;
# TransDateTime InDateTime,OutDateTime;
# RealBase DurationOfStay,OTHours;
#
#
# S3HrmGrade EmplGrade;
# str Department;
# Description Remarks;
# HRPPartyPositionTableRelationship _HRPPartyPositionTableRelationship;
# PositionId PositionId;
# Dimensions _dimensions;
#
#
#}
ENDSOURCE
SOURCE #ColoumnWidth
#void ColoumnWidth(COM _range,int Value)
#{
# //BP Deviation documented
# ColoumnWidth = _range.ColoumnWidth(value);
#}
ENDSOURCE
SOURCE #CreateHeaderDesign
#void CreateHeaderDesign()
#{
# // Transdate localFromDate = fromdate;
# ;
# column = 4;
# this.IncrementRow(1);
#
#
# this.xlInsert(types::String, row, column,"YACHIYO INDIA MANUFACRING PRIVATE LIMITED");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
#
#
# this.IncrementRow();
# ColChar1 = this.getColChar(1);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
#
# this.IncrementColumn(3);
# this.xlInsertPeriodDate(types::String, row, column,"Daily Attendance Report:",fromDate,toDate);
# ColChar = this.getColChar(column);
#
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
#
# this.IncrementRow();
# ColChar1 = this.getColChar(1);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
#
# this.IncrementColumn(0);
# this.xlInsert(types::String, row, column, "S.NO.");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
#
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# this.ExcelFormating2(ColRow1 +":"+colRow2);//
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#
# this.IncrementColumn();
#
# this.xlInsert(types::String, row, column, "Employee Code");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# this.ExcelFormating2(ColRow1 +":"+colRow2);//
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#
# //ns
# this.IncrementColumn();
# this.xlInsert(types::String, row, column, "Employee Name");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# this.ExcelFormating2(ColRow1 +":"+colRow2);//
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#
# this.IncrementColumn();
# this.xlInsert(types::String, row, column, "Department");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# this.ExcelFormating2(ColRow1 +":"+colRow2);//
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#
# //
#
# this.IncrementColumn();
# this.xlInsert(types::String, row, column, "Grade");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# this.ExcelFormating2(ColRow1 +":"+colRow2);//
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#//
# this.IncrementColumn();
# this.xlInsert(types::String, row, column, "Designation");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# this.ExcelFormating2(ColRow1 +":"+colRow2);//
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#//
# this.IncrementColumn();
# this.xlInsert(types::String, row, column, "Shift");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
#
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# this.ExcelFormating2(ColRow1 +":"+colRow2);//
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#
# this.IncrementColumn();
# this.xlInsert(types::String, row, column, "Shift Start Time");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# this.ExcelFormating2(ColRow1 +":"+colRow2);//
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#
# this.IncrementColumn();
# this.xlInsert(types::String, row, column, "In Time");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# this.ExcelFormating2(ColRow1 +":"+colRow2);//
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#
# this.IncrementColumn();
# this.xlInsert(types::String, row, column, "Out Time");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# this.ExcelFormating2(ColRow1 +":"+colRow2);//
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#
# // this.IncrementColumn();
# //this.xlInsert(types::String, row, column, "Hrs Worked");
# //ColChar = this.getColChar(column);
# //ColRow = Strfmt('%1%2',ColChar,row);
# //this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
# //colchar1 = this.getColChar(column);
# //ColRow1 = Strfmt('%1%2',ColChar1,row);
# //ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# //this.ExcelFormating2(ColRow1 +":"+colRow2);//
# //this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# //this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#
# this.IncrementColumn();
# this.xlInsert(types::String, row, column, "Hrs Worked");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# this.ExcelFormating2(ColRow1 +":"+colRow2);//
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#
# this.IncrementColumn();
# this.xlInsert(types::String, row, column, "Status");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# this.ExcelFormating2(ColRow1 +":"+colRow2);//
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#
# this.IncrementColumn();
# this.xlInsert(types::String, row, column, "Late come");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# this.ExcelFormating2(ColRow1 +":"+colRow2);//
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#
#
# this.IncrementColumn();
# this.xlInsert(types::String, row, column, "Early departure");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# this.ExcelFormating2(ColRow1 +":"+colRow2);//
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#
#
# this.IncrementColumn();
# this.xlInsert(types::String, row, column, "Over Time");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
#
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# this.ExcelFormating2(ColRow1 +":"+colRow2);//
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#
#
#
# this.IncrementColumn();
# this.xlInsert(types::String, row, column, "Remarks");
# ColChar = this.getColChar(column);
# ColRow = Strfmt('%1%2',ColChar,row);
# this.xlFormatCell(ColRow,8,true,false,false,1,false,false,'Courier New');
#
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# ColRow2 = Strfmt('%1%2',ColChar1,row+1);//
# this.ExcelFormating2(ColRow1 +":"+colRow2);//
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));//
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);//
#
#
#
# colchar1 = this.getColChar(column);
# ColRow1 = Strfmt('%1%2',ColChar1,row);
# colChar2 = this.getColChar(column);
# colRow2 = Strfmt('%1%2',ColChar2,row);
#
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));
#
# this.resetVariables();
#}
ENDSOURCE
SOURCE #DailyAttendanceReport
#// For Left field inser here
#void DailyAttendanceReport()
#{
# S3AttendanceDetails S3AttendanceDetails2;
#
# Transdate localFromDate = fromDate;
# ;
# this.IncrementRow();
# ColChar1 = this.getColChar(1);
# ColRow1 = Strfmt("%1%2",ColChar1,row);
#
# serNo++;
# //serNo = int2str(row-7);
# this.incrementColumn(0);
#
# this.xlInsert(types::String, row, column,"'"+strfmt("%1",serNo-1));
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
# this.incrementColumn();
#
# this.xlInsert(types::String, row, column,"'"+emplid);
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
# this.incrementColumn();
#
# this.xlInsert(types::String, row, column,name);
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
# this.incrementColumn();
#
#
#
# this.xlInsert(types::String, row, column,Department);
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
# this.incrementColumn();
#
#
# this.xlInsert(types::String, row, column,EmplGrade);
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
# this.incrementColumn();
#
#
# this.xlInsert(types::String, row, column,PositionId);
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
# this.incrementColumn();
#
#
#
# // this.xlInsert(types::String, row, column,Shift);
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
# this.incrementColumn();
#
#
#
#
# // this.xlInsert(types::String, row, column,Shift Start Time);
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
# this.incrementColumn();
#
#
# this.xlInsert(types::String, row, column,datetime2str(InDateTime));
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
# this.incrementColumn();
#
# this.xlInsert(types::String, row, column,datetime2str(OutDateTime));
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
# this.incrementColumn();
#
# this.xlInsert(types::String, row, column,int2str(real2int(DurationOfStay)));
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
# this.incrementColumn();
#
#
#
#
#
# // this.xlInsert(types::String, row, column,Status);
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
# this.incrementColumn();
#
#
#
# // this.xlInsert(types::String, row, column,Late come);
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
# this.incrementColumn();
#
#
#
# // this.xlInsert(types::String, row, column,Early departure);
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
# this.incrementColumn();
#
#
#
# this.xlInsert(types::String, row, column,int2str(real2int(OTHours)));
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
# this.incrementColumn();
#
#
# this.xlInsert(types::String, row, column,Remarks);
# ColChar = this.getColChar(column);
# ColRow = Strfmt("%1%2",ColChar,row);
# this.xlFormatCell(ColRow,9,false,false,false,1,false,false,'calibiri');
# //this.incrementColumn();
#
#
#
#
#
# ColChar2 = this.getColChar(column);
# ColRow2 = strfmt('%1%2',ColChar2,row);
# this.xlGridBorder(this.xlRange(ColRow1,ColRow2),3);
# this.xlAutoFit(this.xlRange(ColRow1,ColRow2));
#
#}
ENDSOURCE
SOURCE #dialog
#public Object dialog()
#{
# DialogRunbase dialog;
# ;
# dialog = super();
# fromDateField = dialog.addField(typeid(Transdate),"From Date",'financial year start date');
# toDateField = dialog.addField(typeid(Transdate),"To Date",'financial year end date');
# fileName = dialog.addField(typeid(FilenameSave),"File Name");
# return dialog;
#}
#
ENDSOURCE
SOURCE #ExcelFormating2
#public void ExcelFormating2(str _rangeName)
#{
# #Excel
# SysExcelFont fontInner;
# COM _char, _r,_text;
# ;
#
# excelApplication.visible(true);
# excelWorkBooks = excelApplication.workbooks();
# excelWorkSheet = excelApplication.activeSheet();
# range = excelWorkSheet.range(_rangeName);
# styles = excelWorkBook.styles();
# _char = range.merge();
# _text = range.HorizontalAlignment(-4108);
#}
ENDSOURCE
SOURCE #getColChar
#str getColChar(int _num)
#{
# str returnvalue = "";
# switch(_num)
# {
# case 1 :
# returnvalue = 'A';
# break;
#
# case 2 :
# returnvalue = 'B';
# break;
#
# case 3 :
# returnvalue = 'C';
# break;
#
# case 4 :
# returnvalue = 'D';
# break;
#
# case 5 :
# returnvalue = 'E';
# break;
#
# case 6 :
# returnvalue = 'F';
# break;
#
# case 7 :
# returnvalue = 'G';
# break;
#
# case 8 :
# returnvalue = 'H';
# break;
#
# case 9 :
# returnvalue = 'I';
# break;
#
# case 10 :
# returnvalue = 'J';
# break;
#
# case 11 :
# returnvalue = 'K';
# break;
#
# case 12 :
# returnvalue = 'L';
# break;
#
# case 13 :
# returnvalue = 'M';
# break;
#
# case 14 :
# returnvalue = 'N';
# break;
#
# case 15 :
# returnvalue = 'O';
# break;
#
# case 16 :
# returnvalue = 'P';
# break;
#
# case 17 :
# returnvalue = 'Q';
# break;
#
# case 18 :
# returnvalue = 'R';
# break;
#
# case 19 :
# returnvalue = 'S';
# break;
#
# case 20 :
# returnvalue = 'T';
# break;
#
# case 21 :
# returnvalue = 'U';
# break;
#
# /* case 22 :
# returnvalue = 'V';
# break;
#
# case 23 :
# returnvalue = 'W';
# break;
#
# case 24 :
# returnvalue = 'X';
# break;
#
# case 25 :
# returnvalue = 'Y';
# break;
#
# case 26 :
# returnvalue = 'Z';
# break;
#
# case 27 :
# returnvalue = 'AA';
# break;
#
# case 28 :
# returnvalue = 'AB';
# break;
#
# case 29 :
# returnvalue = 'AC';
# break;
#
# case 30 :
# returnvalue = 'AD';
# break;
#
#
# case 31 :
# returnvalue = 'AE';
# break;
#
# case 32 :
# returnvalue = 'AF';
# break;
#
# case 33 :
# returnvalue = 'AG';
# break;
#
# case 34 :
# returnvalue = 'AH';
# break;*/
# default:
# returnvalue = '';
# }
# return returnvalue;
#}
ENDSOURCE
SOURCE #getColCharForMonth
#int getColCharForMonth(int _num)
#{
# int returnvalue;
# switch(_num)
# {
# case 4 :
# returnvalue = _num ;
# break;
#
# case 5 :
# returnvalue = _num ;
# break;
#
# case 6 :
# returnvalue = _num;
# break;
#
# case 7 :
# returnvalue = _num;
# break;
#
# case 8 :
# returnvalue = _num;
# break;
#
# case 9 :
# returnvalue = _num;
# break;
#
# case 10 :
# returnvalue = _num;
# break;
#
# case 11 :
# returnvalue = _num;
# break;
#
# case 12 :
# returnvalue = _num;
# break;
#
# case 1 :
# returnvalue = _num + 12;
# break;
#
# case 2 :
# returnvalue = _num + 12;
# break;
#
# case 3 :
# returnvalue = _num + 12;
# break;
#
# default:
# returnvalue = 0;
# }
# return returnvalue;
#}
ENDSOURCE
SOURCE #getFromDialog
#public boolean getFromDialog()
#{
# boolean ret;
# ret = super();
# fromDate = fromDateField.value();
# toDate = toDateField.value();
# fileNameSave = fileName.value();
# if(fromDate > toDate)
# throw error(" from date can not be grater than to date");
# return ret;
#}
ENDSOURCE
SOURCE #IncrementColumn
#int IncrementColumn(int _column = column)
#{
# ;
# column=_column+1;
# return column;
#}
ENDSOURCE
SOURCE #IncrementRow
#int IncrementRow(int _row = row)
#{
# ;
# row=_row+1;
# return row;
#}
ENDSOURCE
SOURCE #initDailyAttendance
#// init for left field
#void initDailyAttendance(S3AttendanceDetails _S3AttendanceDetails)
#{
# ;
# emplid = _S3AttendanceDetails.EmployeeId;
# name =_S3AttendanceDetails.Name;
# // Department= EmplTable::find(_S3AttendanceDetails.EmployeeId).Dimension[1];//[1];
# select _dimensions where _dimensions.Num == EmplTable::find(_S3AttendanceDetails.EmployeeId).Dimension[1];
# Department=_dimensions.Description;
#
#
# EmplGrade = EmplTable::find(_S3AttendanceDetails.EmployeeId).EmplGrade;
# select _HRPPartyPositionTableRelationship where _HRPPartyPositionTableRelationship.Reference ==_S3AttendanceDetails.EmployeeId;
# PositionId= _HRPPartyPositionTableRelationship.Description;
# InDateTime =_S3AttendanceDetails.InDateTime;
# OutDateTime = _S3AttendanceDetails.OutDateTime;
# DurationOfStay = _S3AttendanceDetails.DurationOfStay;
# OTHours = _S3AttendanceDetails.OTHours;
# Remarks = _S3AttendanceDetails.Remarks;
#
#
#
#
#
# // DirPartyTable::find(Empltable::find(emplid).PartyId).Name;
# // relationName= this.emplRelativeName(_emplTable);
# this.DailyAttendanceReport();
#
#
#
#}
ENDSOURCE
SOURCE #new
#void new()
#{
# ;
# queryRun = new QueryRun(querystr(S3AttendanceDetails));
# //SPLPayBonusSummary));
# super();
#}
ENDSOURCE
SOURCE #pack
#public container pack()
#{
# return connull();
#}
ENDSOURCE
SOURCE #queryrun
#public QueryRun queryrun()
#{
# return queryrun;
#}
ENDSOURCE
SOURCE #ResetVariables
#void ResetVariables()
#{
# ;
# ColChar = "";
# ColRow = "";
#}
ENDSOURCE
SOURCE #run
#public void run()
#{
# Query q;
# QueryBuildDatasource qbds;
# // S3payBonusDetail bonusDetails;
# S3AttendanceDetails S3AttendanceDetails3;
# ;
# q = new Query();
# excelApplication = new COM('excel.application');
# //BP Deviation documented
# excelWorkBooks = excelApplication.workBooks();
# //BP Deviation documented
# excelWorkBook = excelWorkBooks.add();
# //BP Deviation documented
# excelWorkSheets = excelWorkBook.worksheets();
# //BP Deviation documented
# excelWorkSheet = excelWorkSheets.add();
# this.CreateHeaderDesign();
# /*q = queryRun.query();
# qbds = q.addDataSource(tablenum(SPLPaySalaryTrans));
# qbds.joinMode(JoinMode::ExistsJoin);
# qbds.relations(true);*/
#
#
# while(queryRun.next())
# {
# S3AttendanceDetails1 = queryRun.get(tablenum(S3AttendanceDetails));
# // select firstonly S3AttendanceDetails1 where S3AttendanceDetails1.EmployeeId == emplTable.EmplId;
# if(S3AttendanceDetails1.RecId)
# {
# // if(!emplTable.EmplGender)
# //throw error(strfmt("Gender is not attached to employee %1",empltable.EmplId));
# this.initDailyAttendance(S3AttendanceDetails1);
# }
# }
#
# //BP Deviation documented
# excelWorkBook.saveAs(fileNameSave);
# //BP Deviation documented
# excelWorkBooks.close();
#}
ENDSOURCE
SOURCE #showQueryValues
#public boolean showQueryValues()
#{
# return true;
#}
ENDSOURCE
SOURCE #unpack
#public boolean unpack(container packedClass)
#{
# return true;
#}
ENDSOURCE
SOURCE #variant2COM
#void variant2COM(COM _COM, COMVariant _variant)
#{
# _COM.attach(_variant.iDispatch());
#}
#
ENDSOURCE
SOURCE #xlAutoFit
#void xlAutoFit(COM _range)
#{
# //BP Deviation documented
# entireColumn = _range.entireColumn();
# //BP Deviation documented
# entirecolumn.autofit();
#}
ENDSOURCE
SOURCE #xlFormatCell
#void xlFormatCell(str _xlRowCol,
# int _fontSize,
# boolean _bold,
# boolean _italic,
# boolean _strikethrough,
# int _underline,
# boolean _Subscript,
# boolean _Superscript,
# str _fontname)
#{
# ;
# //BP Deviation documented
# range = excelWorkSheet.Range(_xlRowCol);
# //BP Deviation documented
# font = range.Font();
# //BP Deviation documented
# font.Size(_fontSize);
# //BP Deviation documented
# font.bold(_bold);
# //BP Deviation documented
# font.italic(_italic);
# //BP Deviation documented
# font.underline(_underline);
# //BP Deviation documented
# font.strikethrough(_strikethrough);
# //BP Deviation documented
# font.Subscript(_Subscript);
# //BP Deviation documented
# font.Superscript(_Superscript);
# //BP Deviation documented
# font.name(_fontname);
#}
#
ENDSOURCE
SOURCE #xlGridBorder
#void xlGridBorder(COM _range,int _weight)
#{
# //BP Deviation documented
# Borders = _range.Borders();
# //BP Deviation documented
# Border = Borders.Item(2);
# //BP Deviation documented
# Border.lineStyle(7);
# //BP Deviation documented
# Border.Weight(_weight);
#
# Borders = null;
# border = null;
# //BP Deviation documented
# Borders = _range.Borders();
# //BP Deviation documented
# Border = Borders.Item(1);
# //BP Deviation documented
# Border.lineStyle(7);
# //BP Deviation documented
# Border.Weight(_weight);
#
# Borders = null;
# border = null;
# //BP Deviation documented
# Borders = _range.Borders();
# //BP Deviation documented
# Border = Borders.Item(8);
# //BP Deviation documented
# Border.lineStyle(7);
# //BP Deviation documented
# Border.Weight(_weight);
#
# Borders = null;
# border = null;
# //BP Deviation documented
# Borders = _range.Borders();
# //BP Deviation documented
# Border = Borders.Item(9);
# //BP Deviation documented
# Border.lineStyle(7);
# //BP Deviation documented
# Border.Weight(_weight);
#
# Borders = null;
# border = null;
# //BP Deviation documented
# Borders = _range.Borders();
# //BP Deviation documented
# Border = Borders.Item(3);
# //BP Deviation documented
# Border.lineStyle(7);
# //BP Deviation documented
# Border.Weight(_weight);
#
#}
ENDSOURCE
SOURCE #xlInsert
#void xlInsert(Types _types,
# int _row,
# int _col,
# str _value)
#
#{
# //BP Deviation documented
# excelcell = excelworksheet.cells();
# //BP Deviation documented
# this.variant2COM(excelcell, excelcell.item(_row,_col));
# //BP Deviation documented
# excelcell.value2(_value);
#}
#
#
#
#
ENDSOURCE
SOURCE #xlInsertaddFromYear
#void xlInsertaddFromYear(Types _types,
# int _row,
# int _col,
# str _value,
# TransDate _fromDate)
#{
# str fromYear;
# ;
# fromYear = int2str(year(_fromDate));
# //BP Deviation documented
# excelcell = excelworksheet.cells();
# //BP Deviation documented
# this.variant2COM(excelcell, excelcell.item(_row,_col));
# _value = _value + fromYear;
# //BP Deviation documented
# excelcell.value2(_value);
#}
#
#
#
#
ENDSOURCE
SOURCE #xlInsertaddTOYear
#void xlInsertaddTOYear(Types _types,
# int _row,
# int _col,
# str _value,
# TransDate _toDate)
#{
# str toYear;
# ;
# toYear = int2str(year(_toDate));
# //BP Deviation documented
# excelcell = excelworksheet.cells();
# //BP Deviation documented
# this.variant2COM(excelcell, excelcell.item(_row,_col));
# _value = _value + toYear;
# //BP Deviation documented
# excelcell.value2(_value);
#}
#
#
#
#
ENDSOURCE
SOURCE #xlInsertPeriodDate
#void xlInsertPeriodDate(Types _types,
# int _row,
# int _col,
# str _value,
# TransDate _fromDate,
# TransDate _toDate)
#{
# str fromYear;
# str toYear;
# str fromMonthName;
# str toMonthName;
# ;
# fromYear = int2str(year(_fromDate));
# toYear = int2str(year(_toDate));
# //BP Deviation documented
# excelcell = excelworksheet.cells();
# //BP Deviation documented
# this.variant2COM(excelcell, excelcell.item(_row,_col));
# //BP Deviation documented
# fromMonthName = mthname(mthofyr(_fromDate)) + "-";
# toMonthName = mthname(mthofyr(_toDate)) + "-";
# _value = _value + fromMonthName + fromYear;
# _value = _value + " " +"To"+ " " + toMonthName + toYear;
# //BP Deviation documented
# excelcell.value2(_value);
#}
#
#
#
#
ENDSOURCE
SOURCE #xlRange
#com xlRange(str _row, str _col)
#{
# ;
# //BP Deviation documented
# range = excelWorkSheet.Range(_row,_col);
# return range;
#}
ENDSOURCE
SOURCE #xlShow
#void xlShow()
#{
# //BP Deviation documented
# excelApplication.visible(true);
#}
ENDSOURCE
SOURCE #main
#static void main(Args _args)
#{
# S3AttendanceDetailsReport AttendanceDetail;
# //SPLPayBonusSummaryReport payBonusSummary;
# ;
# AttendanceDetail = new S3AttendanceDetailsReport();
# //payBonusSummary = new SPLPayBonusSummaryReport();
#
# if(AttendanceDetail.prompt())
# {
# AttendanceDetail.run();
# }
# //if(payBonusSummary.prompt())
# // {
# // payBonusSummary.run();
# //}
#}
#
ENDSOURCE
ENDMETHODS
ENDCLASS
***Element: END