dear masbin udah bisa di test ya
update :
function updateCalculate() {
console.log('updateCalculate >>');
var me = this;
var taskId = MinovaUtil.WORKFLOW.getTaskId();
var empId = MinovaUtil.WORKFLOW.getEmpId();
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
var cbCostType = body.down('[id=PDSWFTRAVELCOSTCostCostType]');
var gridCost = body.down('[name=PDSWFTRAVELCOST]');
var gridCostStore = Ext.StoreManager.lookup('storePDSWFTRAVELCOST');
var costAmountPlan = 0;
var totalCostAmountPlan = 0;
var CostAmountSettlement = 0;
var totalCostAmountSettlement = 0;
var HeaderTravelStatus = body.down('[name=HeaderTravelStatus]').getValue();
Ext.each(gridCostStore.getRange(), function (rec) {
costAmountPlan = parseInt(rec.get('CostRate')) * parseInt(rec.get('CostNumber'));
if (HeaderTravelStatus == '01') {
if (!Ext.isEmpty(parseInt(rec.get('CostAmountPlan')))) {
MinovaUtil.ExecuteParamQuery({
ID: "WFTVAMOUNT",
empId: empId,
stDate: rec.get('CostStartDate'),
costType: rec.get('CostCostType'),
costAmount: rec.get('CostAmountPlan'),
langId: MinovaUtil.GetLangID()
}, function (s) {
var result = Ext.decode(s.responseText);
var dt = Ext.decode(Ext.decode(result.data));
if (dt0.WarningType === '1') {
MinovaMessageError("Error", dt0.WarningId, "");
rec.set('CostAmountPlan', '');
rec.set('CostRate', '');
}
}, function (f) {});
}
rec.set('CostAmountPlan', costAmountPlan);
totalCostAmountPlan += costAmountPlan;
} else {
if (!Ext.isEmpty(parseInt(rec.get('CostAmountSettlement')))) {
MinovaUtil.ExecuteParamQuery({
ID: "WFTVAMOUNT",
empId: empId,
stDate: rec.get('CostStartDate'),
costType: rec.get('CostCostType'),
costAmount: rec.get('CostAmountSettlement'),
langId: MinovaUtil.GetLangID()
}, function (s) {
var result = Ext.decode(s.responseText);
var dt = Ext.decode(Ext.decode(result.data));
if (dt0.WarningType === '1') {
MinovaMessageError("Error", dt0.WarningId, "");
rec.set('CostAmountSettlement', '');
rec.set('CostRate', '');
}
}, function (f) {});
}
rec.set('CostAmountSettlement', costAmountPlan);
totalCostAmountSettlement += CostAmountSettlement;
}
});
}
function calcratetv() {
var body = MinovaUtil.WORKFLOW.getViewBodyWorkflow();
var TrvStats = body.down('[name=HeaderTravelStatus]').getValue();
var hsl = '0';
var rate = Ext.ComponentQuery.query('[id=PDSWFTRAVELCOSTCostRate]')[0].getValue();
var num = Ext.ComponentQuery.query('[id=PDSWFTRAVELCOSTCostNumber]')[0].getValue();
var rt = parseFloat(rate);
var nm = parseFloat(num);
if (TrvStats == '01') {
hsl = rt * nm;
Ext.ComponentQuery.query('[id=PDSWFTRAVELCOSTCostAmountPlan]')[0].setValue(hsl);
} else {
hsl = rt * nm;
Ext.ComponentQuery.query('[id=PDSWFTRAVELCOSTCostAmountSettlement]')[0].setValue(hsl);
}
}
Package :
- bizproc : 'Travel' (onmethod)
makasih