Dear Jihad, sudah di update ya
UPDATE nya di
SDATATABLEFIELD > TableName = PTRSALESITEMS, FieldName = Material, Column = SelectFunction
debugger;
var store = Ext.StoreMgr.lookup("storePTRSALESITEMS");
var idx = store.getCount() - 1;
var materialID = val.value;
var map;
var unitmasurement;
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;
}
});
var max1;
for (var i = 0; i < dtgrid1.length; i++) {
max1 = dtgrid1[i];
}
if (max1 != undefined) {
store.getAt(idx).set('UnitTransaction', max1.UnitMeasurement);
store.getAt(idx).set('MaterialType', max1.MaterialType);
} else {
store.getAt(idx).set('UnitTransaction', '1');
store.getAt(idx).set('MaterialType', '1');
};
Ext.Ajax.request({
async: false,
method: 'POST',
url: '/UserControl/GetStore',
params: {
tableName: 'PMDMAT0002',
param: 'MaterialID[=]' + materialID
},
success: function (response) {
var results = Ext.decode(response.responseText);
dtgrid = results.data;
}
});
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.StandardPrice);
store.getAt(idx).set('Discount', max.Discount);
var _discount = max.StandardPrice * max.Discount / 100;
var netamount = Math.round(max.StandardPrice - _discount);
store.getAt(idx).set('NetAmount', netamount);
store.getAt(idx).set('TaxType', '1');
var _tax = netamount / 1.1;
var tax = Math.round(netamount - _tax);
store.getAt(idx).set('Tax', tax);
store.getAt(idx).set('TotAmount', netamount);
store.getAt(idx).set('Currency', max.Currency);
} else {
store.getAt(idx).set('PriceAmount', 0);
store.getAt(idx).set('Discount', 0);
store.getAt(idx).set('NetAmount', 0);
store.getAt(idx).set('TaxType', '1');
store.getAt(idx).set('Tax', 0);
store.getAt(idx).set('TotAmount', 0);
};