Project

General

Profile

Bug #3328

Ketika input Diskon masih ngaco rownya

Added by haykal haykal about 2 months ago. Updated 15 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Start date:
01/06/2025
Due date:
% Done:

0%

Estimated time:

Description

Dear Shofwan,

Tadi ketika saya coba membuat transaksi di Purchase Order saya coba mengisikan diskonnya. Saya mengisikan field Disc% di row 1 tapi malah mempengaruhi field Discount dan Net Amount di row 2 (Foto 1). Lalu saya coba mengisi field Discount di row 1 tapi malah mempengaruhi Net Amount di row 2 (Foto 2).

Tolong diperbaiki ya Wan agar Discountnya mempengaruhi Net Amount di row yang sama.

Terimakasih.

Menu Path: Logistic & Service > Purchasing > Purchase Order
Port: http://remote.minovais.com:61138/
DB: MinovaES_KJL_Prod (di 1452)


Files

Diskon masih ngaco rownya.PNG (17.1 KB) Diskon masih ngaco rownya.PNG Foto 1 haykal haykal, 01/06/2025 03:46 PM Delete
Discount masih ngaco.PNG (17.2 KB) Discount masih ngaco.PNG Foto 2 haykal haykal, 01/06/2025 03:47 PM Delete
clipboard-202501070943-qqmpa.png (41.2 KB) clipboard-202501070943-qqmpa.png shofwan shiddiq, 01/07/2025 09:43 AM Delete
clipboard-202501070944-yalbg.png (46.2 KB) clipboard-202501070944-yalbg.png shofwan shiddiq, 01/07/2025 09:44 AM Delete
clipboard-202501071459-zhclq.png (27.7 KB) clipboard-202501071459-zhclq.png hans hans, 01/07/2025 02:59 PM Delete
clipboard-202501071500-tykub.png (53.6 KB) clipboard-202501071500-tykub.png hans hans, 01/07/2025 03:00 PM Delete

Add

Subtasks


Add

Related issues

#1

Updated by Kezia Pawitra Yulianti about 2 months ago

  • Status changed from New to Assigned

Updated by shofwan shiddiq about 2 months ago

Dear Hans, boleh tolong untuk di bantu case yg ini. untuk query perhitungan discount nya ada di

TableName = SDATATABLEFIELD, FieldName = Discount, nanti di kolom SelectFunction. nanti di ubah nya di script ini

Updated by hans hans about 2 months ago

Halo mas Haykal, untuk input diskon sudah diperbaiki

UPDATE:
port: 1452
DB: MinovaES_KJL_Prod
Table: SDATATABLEFIELD

Filter:
TableName: PTRPURCHITEM
FieldName: DiscountPercentage & Discount

Updated by haykal haykal about 1 month ago

  • Status changed from Assigned to Revise
  • Assignee changed from haykal haykal to hans hans

Dear Hans,

Untuk field-field yg memang wajib diisikan angka (dan berpengaruh di kalkulasi) tlg di disabled aja ya apabila usernya mengisi format selain angka.

Terimakasih.

Updated by hans hans about 1 month ago

  • Assignee changed from hans hans to haykal haykal

Halo mas Haykal

Untuk disable setiap input yang bertipe selain number akan otomatis menjadi 0

UPDATE:
port: 1452
DB: MinovaES_KJL_Prod
Table: SDATATABLEFIELD

Filter:
TableName: PTRPURCHITEM
FieldName: Discount, DiscountPercentage, MaterialQuantity, PriceAmount

Updated by haykal haykal about 1 month ago

  • Assignee changed from haykal haykal to hans hans

Hans, untuk perhitungan yang di Total Amount nya bener seperti yang lu bilang. Jadi setelah Total Amount itu terpotong nilai Discount, Pajak 11% nya hrs terhitung juga di Total Amount.

Note: Cek juga nilai yg di footer Tax Amount nya udh bener atau belom.

Terimakasih.

Updated by hans hans about 1 month ago

  • Assignee changed from hans hans to haykal haykal

Halo mas Haykal

Untuk perhitungan sudah diperbaiki

UPDATE:
port: 1452
DB: MinovaES_KJL_Prod
Table: SDATATABLEFIELD

Filter:
TableName: PTRPURCHITEM
FieldName: Discount, DiscountPercentage, MaterialQuantity, PriceAmount

Backup:


// record discount
debugger;
var store = Ext.StoreMgr.lookup("storePTRPURCHITEM");

if (store !== undefined) {
    var grid = Ext.getCmp(gridName);
    var selection = grid.getView().getSelectionModel().getSelection()[0];
    var idx = grid.store.indexOf(selection);

    var discount = Number(val.value);
    var rec = store.getAt(idx);

    var priceAmount = rec.get('PriceAmount');
    var materialQuantity = rec.get('MaterialQuantity');

    var netAmount, totAmount;
    if (!isNaN(discount)) {
        netAmount = (materialQuantity * priceAmount) - discount;
        totAmount = (materialQuantity * priceAmount) - discount;
    } else {
        netAmount = 0
        totAmount = 0
    }

    rec.set({
        "NetAmount": netAmount,
        "TotAmount": totAmount
    }); // upd 3
}

// record discountPercentage
debugger;
var store = Ext.StoreMgr.lookup("storePTRPURCHITEM");

if (store != undefined) {
    var grid = Ext.getCmp(gridName);
    var selection = grid.getView().getSelectionModel().getSelection()[0];
    var idx = grid.store.indexOf(selection);

    var discPercentage = Number(val.value);
    var rec = store.getAt(idx);

    var priceAmount = rec.get('PriceAmount');
    var materialQuantity = rec.get('MaterialQuantity');

    var totAmount, netAmount;
    if (!isNaN(discPercentage)) {
        var discount = (priceAmount * materialQuantity * discPercentage) / 100;
        TotAmount = (materialQuantity * priceAmount) - discount;
        netAmount = (materialQuantity * priceAmount) - discount;
    } else {
        TotAmount = 0;
        netAmount = 0;
    }

    rec.set({
        "NetAmount": netAmount,
        "TotAmount": totAmount,
        "Discount": discount 
    }); // upd 3

    var taxtype;
    if (taxtype != '') {
        taxtype = rec.get('TaxType');
    } else {
        taxtype = '1';
    }

    var persenparam = '0';
    Ext.Ajax.request({
        async: false,
        method: 'POST',
        url: '/UserControl/GetStore',
        params: {
            tableName: 'PCMEPGENPARAM',
            param: 'Parameter[=]TAXPPNPERCENTAGE'
        },
        success: function (response) {
            var results = Ext.decode(response.responseText);
            persenparam = results.data[0].Value1;
            console.log(persenparam);
        }
    });

    var tax = "0";
    var totAmount = 0;

    if (taxtype === '2') {
        tax = Math.round(netAmount * (parseFloat(persenparam) / 100));
        totAmount = netAmount + tax;
    } else if (taxtype === '1') {
        var _tax = netAmount / ((100 + parseFloat(persenparam)) / 100);
        tax = Math.round(netAmount - _tax);
        totAmount = netAmount;
    }

    store.getAt(idx).set('TotAmount', totAmount);
    store.getAt(idx).set('Tax', tax);
    // store.getAt(idx).set('TaxType', '1');
}

// record materialQuantity
var store = Ext.StoreMgr.lookup("storePTRPURCHITEM");
if (store != undefined) {
    // var idx = store.getCount() - 1;

    var grid = Ext.getCmp(gridName);
    var selection = grid.getView().getSelectionModel().getSelection()[0];
    var idx = grid.store.indexOf(selection); // upd 1

    var val = Number(val.value);
    var materialQuantity = isNaN(val) ?  0 : val; // upd 1;

    var priceAmount = store.getAt(idx).get('PriceAmount');
    var discount = store.getAt(idx).get('Discount');
    var discountpercentage = store.getAt(idx).get('DiscountPercentage');
    if (discountpercentage > 0) {
        discount = (materialQuantity * priceAmount) * (discountpercentage / 100)
    } else {
        discount = 0
    }

    var netAmount = (materialQuantity * priceAmount) - discount;
    store.getAt(idx).set('NetAmount', netAmount);

    var persenparam = '0';
    Ext.Ajax.request({
        async: false,
        method: 'POST',
        url: '/UserControl/GetStore',
        params: {
            tableName: 'PCMEPGENPARAM',
            param: 'Parameter[=]TAXPPNPERCENTAGE'
        },
        success: function(response) {
            var results = Ext.decode(response.responseText);
            persenparam = results.data[0].Value1;
            console.log(persenparam);
        }
    });

    var taxtype = undefined;
    if (taxtype != '') {
        taxtype = store.getAt(idx).get('TaxType');
    } else {
        taxtype = '1';
    }

    var totAmount = '0';
    if (taxtype === '2') {
        tax = Math.round(netAmount * (parseFloat(persenparam) / 100));
        totAmount = (netAmount + tax);
    } else if (taxtype === '1') {
        var _tax = netAmount / ((100 + parseFloat(persenparam)) / 100);
        tax = Math.round(netAmount - _tax);
        totAmount = netAmount;
    }

    store.getAt(idx).set('TotAmount', totAmount);
    store.getAt(idx).set('Tax', tax);
    // store.getAt(idx).set('Discount', discount);
}

// record priceAmount
var store = Ext.StoreMgr.lookup("storePTRPURCHITEM");
if (store != undefined) {
    // var idx = store.getCount() - 1;

    var grid = Ext.getCmp(gridName);
    var selection = grid.getView().getSelectionModel().getSelection()[0];
    var idx = grid.store.indexOf(selection); // upd 1

    var val = Number(val.value);
    var priceAmount= isNaN(val) ?  0 : val; // upd 1;

    var materialQuantity = store.getAt(idx).get('MaterialQuantity');
    var discountPercentage = store.getAt(idx).get('DiscountPercentage');
    var discount = Math.round((priceAmount * materialQuantity) * (discountPercentage / 100));
    var netAmount = Math.round((materialQuantity * priceAmount) - discount);
    store.getAt(idx).set('NetAmount', netAmount);
    // store.getAt(idx).set('Discount', discount);

    var taxtype;
    if (taxtype != '') {
        taxtype = store.getAt(idx).get('TaxType');
    } else {
        taxtype = '1';
    }

    var persenparam = '0';
    Ext.Ajax.request({
        async: false,
        method: 'POST',
        url: '/UserControl/GetStore',
        params: {
            tableName: 'PCMEPGENPARAM',
            param: 'Parameter[=]TAXPPNPERCENTAGE'
        },
        success: function(response) {
            var results = Ext.decode(response.responseText);
            persenparam = results.data[0].Value1;
            console.log(persenparam);
        }
    });
    var tax = "0";
    var totAmount = 0;
    if (taxtype === '2') {
        tax = Math.round(netAmount * (parseFloat(persenparam) / 100));
        totAmount = (netAmount + tax);
    } else if (taxtype === '1') {
        var _tax = netAmount / ((100 + parseFloat(persenparam)) / 100);
        tax = Math.round(netAmount - _tax);
        totAmount = netAmount;
    }

    store.getAt(idx).set('TotAmount', totAmount);
    store.getAt(idx).set('Tax', tax);
}

Updated by haykal haykal 15 days ago

  • Status changed from Revise to Deploy
  • Assignee changed from haykal haykal to hans hans

Udh ok Hans. Minta tolong di-deploy ke KJL Prod ya...

Port: https://hris-kjl-prod.minovais.com/
DB: MinovaES_KJL_Prod (103.153.60.89)

Terimakasih.

Updated by hans hans 15 days ago

  • Assignee changed from hans hans to haykal haykal

Dear mas Haykal,

sudah selesai deploy, terima kasih

#10

Updated by haykal haykal 15 days ago

  • Status changed from Deploy to Closed

Also available in: Atom PDF