Dear Jihad, auto load Material Type sudah di tambahkan, silahkan di testing
SDATATABLEFIELD > TableName = PTRMATERIALITEM; FieldName = MaterialID;
SelectFunction:
debugger; var store = Ext.StoreMgr.lookup("storePTRMATERIALITEM");
if (store != undefined) {
var idx = store.getCount() - 1;
var materialID = val.value;
Ext.Ajax.request({
async: false,
method: 'POST',
url: '/UserControl/GetStore',
params: {
tableName: 'PMDMAT0003',
param: 'MaterialID[=]' + materialID
},
success: function (response) {
var results = Ext.decode(response.responseText);
dtgrid = results.data;
}
});
var map;
var unitmasurement;
var material_type;
Ext.Ajax.request({
async: false,
method: 'POST',
url: '/UserControl/GetStore',
params: {
tableName: 'PMDMAT0001',
param: 'MaterialID[=]' + materialID
},
success: function (response) {
var results = Ext.decode(response.responseText);
dtgrid1 = results.data;
}
});
map = dtgrid10.MAP;
unitmasurement = dtgrid10.UnitMeasurement;
material_type = dtgrid10.MaterialType;
store.getAt(idx).set('UnitMeasurement', unitmasurement);
store.getAt(idx).set('MaterialType', material_type);
if (map != undefined) {
store.getAt(idx).set('NetPrice', map);
} else {
store.getAt(idx).set('NetPrice', 0);
};
var max;
for (var i = 0; i < dtgrid.length; i++) {
if (!max || parseInt(dtgrid[i]["SeqID"]) > parseInt(max["SeqID"]))
max = dtgrid[i];
}
if (max != undefined) {
store.getAt(idx).set('PriceAmount', max.PurchasePrice);
store.getAt(idx).set('Discount', max.Discount);
} else {
store.getAt(idx).set('PriceAmount', map);
store.getAt(idx).set('Discount', 0);
}
}