Code
Code
Code
I.Daiagram :
1.Get Dates
var today = new Date();
tw.local.endDate = new Date(today.getFullYear(), today.getMonth()+1, 0);
tw.local.startDate = new Date(today.getFullYear(), today.getMonth(), 1);
2. Fetch Cash Expenses - Current Month
Cash Expenses Search GSS:
var processInstanceId = new TWSearchColumn();
processInstanceId.type = TWSearchColumn.Types.ProcessInstance;
processInstanceId.name = TWSearchColumn.ProcessInstanceColumns.ID;
var processInstanceName = new TWSearchColumn();
processInstanceName.type = TWSearchColumn.Types.ProcessInstance;
processInstanceName.name = TWSearchColumn.ProcessInstanceColumns.Name;
var processStatus = new TWSearchColumn();
processStatus.type = TWSearchColumn.Types.ProcessInstance;
processStatus.name = TWSearchColumn.ProcessInstanceColumns.Status;
var processName = new TWSearchColumn();
processName.type = TWSearchColumn.Types.Process;
processName.name = TWSearchColumn.ProcessColumns.Name;
var paidDate = new TWSearchColumn();
paidDate.type = TWSearchColumn.Types.BusinessData;
paidDate.name = 'CE_PaidDate';
var category = new TWSearchColumn();
category.type = TWSearchColumn.Types.BusinessData;
category.name = 'CE_Category';
var subCategory = new TWSearchColumn();
subCategory.type = TWSearchColumn.Types.BusinessData;
subCategory.name = 'CE_SubCategory';
var paidTo = new TWSearchColumn();
paidTo.type = TWSearchColumn.Types.BusinessData;
paidTo.name = 'CE_PaidTo';
var comments = new TWSearchColumn();
comments.type = TWSearchColumn.Types.BusinessData;
comments.name = 'CE_Comments';
var paidBy = new TWSearchColumn();
paidBy.type = TWSearchColumn.Types.BusinessData;
paidBy.name = 'CE_PaidBy';
var amount = new TWSearchColumn();
amount.type = TWSearchColumn.Types.BusinessData;
amount.name = 'CE_Amount';
var approvalStatus = new TWSearchColumn();
approvalStatus.type = TWSearchColumn.Types.BusinessData;
approvalStatus.name = 'CE_ApprovalStatus';
var processStatusCondition = new TWSearchCondition();
processStatusCondition.column = processStatus;
processStatusCondition.operator = TWSearchCondition.Operations.Equals;
processStatusCondition.value = "Terminated";
var processNameCondition = new TWSearchCondition();
processNameCondition.column = processName;
processNameCondition.operator = TWSearchCondition.Operations.Equals;
processNameCondition.value = "Cash Expenses";
/*
var defaultSDF = new Packages.java.text.SimpleDateFormat("E MMM dd HH:mm:ss Z yy
yy");
var defaultDb2SDF = new Packages.java.text.SimpleDateFormat("yyyy-MM-dd HH:MM:SS
.s");
var startDate = tw.local.startDate;
var startDateString = startDate.toString();
var paidDateStart = defaultSDF.parse(startDateString);
var formatedStartDate = defaultDb2SDF.format(paidDateStart);
var db2StartDate = defaultDb2SDF.parse(formatedStartDate);
log.info("----------------------db2StartDate----------------------------------------");
log.info(formatedStartDate);
var endDate = tw.local.endDate;
var endDateString = endDate.toString();
var paidDateEnd = defaultSDF.parse(endDateString);
var formatedEndDate = defaultDb2SDF.format(paidDateEnd);
var db2EndDate = defaultDb2SDF.parse(formatedEndDate);
log.info("----------------------db2EndDate----------------------------------------");
log.info(formatedEndDate);
*/
var paidDateStartCondition = new TWSearchCondition();
paidDateStartCondition.column = paidDate;
paidDateStartCondition.operator = TWSearchCondition.Operations.GreaterThan;
paidDateStartCondition.value = tw.local.startDate.format("MM/dd/yyyy HH:mm:ss",
"PST");
var paidDateEndCondition = new TWSearchCondition();
paidDateEndCondition.column = paidDate;
paidDateEndCondition.operator = TWSearchCondition.Operations.LessThan;
paidDateEndCondition.value = tw.local.endDate.format("MM/dd/yyyy HH:mm:ss", "PST
");
var searchOrdering = new TWSearchOrdering();
searchOrdering.Order = TWSearchOrdering.Orders.Descending;
searchOrdering.column = processInstanceId;
//var selectColumns = new Array(processInstanceId,processInstanceName,processSta
tus,paidDate);
var selectColumns = new Array(processInstanceId,processInstanceName,processStatu
s,paidDate,category,subCategory,paidTo,paidBy,amount,approvalStatus,processName,
comments);
//var searchConditions = new Array(processStatusCondition,processNameCondition);
var searchConditions = new Array(processNameCondition,paidDateStartCondition,pai
dDateEndCondition);
//var searchConditions = new Array(processNameCondition);
}
if(row.values[10]){
tw.local.cashExpenses[i].mainProcessName = row.values[10].toString()
;
}
if(row.values[11]){
tw.local.cashExpenses[i].comments = row.values[11].toString();
}
}
}
border-radius: 4px;
text-align: center;
font-size: 14px;
font-weight: bold;
background-repeat: repeat-x;
padding-bottom: 0px;
border: 1px solid #21486c;
border-top-color: #4178aa;
border-left-color: #4178aa;
border-bottom-color: #21486c;
border-right-color: #21486c;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#1B76BC',
endColorstr='#124B80');
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#1B76BC',
endColorstr='#124B80')";
background-position: 0px 0px;
background-image: linear-gradient(bottom, #124B80 0%, #1B76BC 100%);
background-image: -o-linear-gradient(bottom, #124B80 0%, #1B76BC 100%);
background-image: -moz-linear-gradient(bottom, #124B80 0%, #1B76BC 100%);
background-image: -webkit-linear-gradient(bottom, #124B80 0%, #1B76BC 100%);
background-image: -ms-linear-gradient(bottom, #124B80 0%, #1B76BC 100%);
background-image: -webkit-gradient( linear, left bottom, left top, color-stop(0,
#124B80),
color-stop(1, #1B76BC) );
}
.claro .BPMButton .dijitButton .dijitButtonNode:hover {
color: #fff;
border-top-color: #4178aa;
border-left-color: #4178aa;
border-bottom-color: #21486c;
border-right-color: #21486c;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#429CE2',
endColorstr='#124B80');
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#429CE2',
endColorstr='#124B80')";
background-image: linear-gradient(bottom, #124B80 0%, #429CE2 100%);
background-image: -o-linear-gradient(bottom, #124B80 0%, #429CE2 100%);
background-image: -moz-linear-gradient(bottom, #124B80 0%, #429CE2 100%);
background-image: -webkit-linear-gradient(bottom, #124B80 0%, #429CE2 100%);
background-image: -ms-linear-gradient(bottom, #124B80 0%, #429CE2 100%);
background-image: -webkit-gradient( linear, left bottom, left top, color-stop(0,
#124B80),
color-stop(1, #429CE2) );
-moz-box-shadow: 0 2px 3px rgba(0,0,0,.5);
-webkit-box-shadow: 0 2px 3px rgba(0,0,0,.5);
box-shadow: 0 2px 3px rgba(0,0,0,.5);
}
.claro .BPMButton .dijitButtonDisabled .dijitButtonNode, .claro .myBPMButton .di
jitButtonDisabled .dijitButtonNode:hover {
color: #a0a0a0;
background-color: #113f66;
cursor: not-allowed;
}
.BPMButton .dijitDisabled * {
cursor: not-allowed;
}
.BPMButton .dijitButtonText {
margin-top: 2px;
}
</style>