Skip to main content

Show Posts

This section allows you to view all Show Posts made by this member. Note that you can only see Show Posts made in areas you currently have access to.

Messages - truerad

2
Issues / UseHTMLEditor Not Working
I've been browsing for several days both on Google and in this community, but until now I haven't found a solution to why the textarea property useHTMLeditor is not working as it should.

If anyone has successfully implemented it, please share.....
and I will be very grateful
3
General Discussion / Re: Set Date (Date Picker) Value from ClientEvents
Hi jameswilliam, thanks for your advice.

I actually avoid using the timestamp, because what I want is to record the change_date only if the price field changes.
if the user changes other fields besides the price field then the change_date should not change.
4
General Discussion / Set Date (Date Picker) Value from ClientEvents
Hi... can anyone help me.
I just want to make automatically change a date (date-picker: tgl_perubahan) value to today when user change the price (harga_satuan) value.
This is my script on clientevents:
Code: [Select]
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!

var yyyy = today.getFullYear();
if(dd<10){dd='0'+dd} if(mm<10){mm='0'+mm} today = yyyy+'-'+mm+'-'+dd;

$(document.body).on('change keyup input', 'input[name="harga_satuan"]', function() {
    $('#ctrl-tgl_perubahan').val(today);
});
Note :
#ctrl-tgl_perubahan : id of a date field
harga_satuan : name of a price field

5
General Discussion / Javascript ClientEvents Working on Add Page but not in Edit Page
Hi All PHPRad Lovers...

I have facing the problem. I had using PHPRAD V2.7.3

In my project i put Clientevents :
Code: [Select]
var varTempo = 0;

$(document.body).on('change',"#ctrl-Customer",function (e) {
    var pro = $("#ctrl-Customer option:selected").text();


   
    let arrCust = pro.split(' | ');

    var dd = document.getElementById('ctrl-Sales');
    for (var i = 0; i < dd.options.length; i++) {
        if (dd.options[i].value === arrCust[1]) {
            dd.selectedIndex = i;
            break;
        }
    }
   
    //Isi Field Sesuai nilai array
    $('input[name="Limit_Kredit"]').val(arrCust[2]);
    $('input[name="Total_Piutang"]').val(arrCust[3]);
    $('input[name="Tempo_Pembayaran"]').val(arrCust[4]);
    $('input[name="Contact_Person"]').val(arrCust[5]);
   

    //Tampilkan Nilai PPN
    var nppn = 0;
    var hppn = arrCust[6];
    hppn = hppn.replace(/^\s+|\s+$/gm,'');
    if (hppn === "Y") {
        nppn = 10;
    } else {
        nppn = 0;
    }
    $('input[name="PPN"]').val(nppn);

    //Set Tanggal Tempo Pembayaran
    varTempo = arrCust[4]
    setTglTempo();
   
    //Hitung Total
    nilaiPPN = nppn;
    hitungTotal();
});


$(document.body).on('change', 'input[name="Tgl_Rencana_Kirim"]', function() {
    //Set Tanggal Tempo Pembayaran
    setTglTempo();
});

$(document.body).on('change keyup input', 'input[name="Tempo_Pembayaran"]', function() {
    //Set Tanggal Tempo Pembayaran
    varTempo = $(this).val();
    setTglTempo();
});


function setTglTempo() {
    var trk = new Date(document.getElementById('ctrl-Tgl_Rencana_Kirim').value);

    trk.setDate(trk.getDate() + parseInt(varTempo));
   
    var ttp = trk.toISOString().slice(0, 10);
   
    $('input[name="Tgl_Tempo_Pembayaran"]').val(ttp);
};


var disRupiah = 0;
var disPersen = 0;
var nilaiPPN =0;


$(document.body).on('change keyup input', 'input[name="Diskon_Persen"]', function() {
    //Hitung Total
    disPersen = $(this).val();
    hitungTotal();
});

$(document.body).on('change keyup input', 'input[name="Diskon_Rupiah"]', function() {
    //Hitung Total
    disRupiah = $(this).val();
    hitungTotal();
});

$(document.body).on('change keyup input', 'input[name="PPN"]', function() {
    //Hitung Total
    nilaiPPN = $(this).val();
    hitungTotal();
});

function hitungTotal() {
    var gtADP = 0;
    var gtAD = 0;
    var gtAP = 0;

    gt = document.getElementById('ctrl-Grand_Total').value;
    alert(gt);
   
    gtADP = parseInt(gt) * parseInt(disPersen) / 100;
    gtAD = parseInt(gt) - gtADP - parseInt(disRupiah);
    $('input[name="GT_AD"]').val(gtAD);
   
    gtAP = gtAD + (gtAD * parseInt(nilaiPPN) / 100);
    $('input[name="GT_AP"]').val(gtAP);
};

The problem is, that script can running properly on Add Page, But not Running ini Edit Page.
6
Questions / Re: [solved] Chart not displaying
Hi Erwin & Willvin....
Can you share here the solutions of the topics (Chart not Display), so anyone who facing the same issue can get the solution either.
Thanks....
7
General Discussion / Re: ClientEvents Not Working on Modal
after trying, trying again, and keep trying.... finally I succeeded...
I share it here for anyone who might need it....

Code: [Select]
var jml = 0;
var hrg = 0;
var tot = 0;

$(document.body).on('change',"#ctrl-Produk",function (e) {
    var pro = $("#ctrl-Produk option:selected").text();
    pro = pro.replace(/ /g,'');

   
    let arrpro = pro.split('|');
    $('input[name="Satuan"]').val(arrpro[1]);
    $('input[name="Harga"]').val(arrpro[2]);
    hrg = arrpro[2];
    setTotal();
});

$(document.body).on('change keyup input', 'input[name="Jumlah"]', function() {
    jml = $(this).val();
    setTotal();
});

$(document.body).on('change keyup input', 'input[name="Harga"]', function() {
    hrg = $(this).val();
    setTotal();
});

function setTotal() {
    tot = parseInt(jml, 10) * parseInt(hrg, 10);
    $('input[name="Total"]').val(tot);
};

Thank you so much @willvin for your response and support.....   
8
General Discussion / Graph on dashboard is blank... not display anything
I try to use graph component in dashboard, but the result is blank box (not displaying anything).
And then i try to use phprad from radysystem using the same database & query, the result is good (graph displayed)

This is the script of graph that i copy from inspector :
Code: [Select]

                            $(function (){
                            var chartData = {
                            labels : ["9","10"],
                            datasets : [
                            {
                            label: 'Dataset 1',
                            backgroundColor:[
                            'rgba(138,94,38,0.5)','rgba(159,207,225,0.5)',                            ],
                            borderWidth:3,
                            pointStyle:'circle',
                            pointRadius:5,
                            lineTension:0.1,
                            type:'line',
                            steppedLine:true,
                            data : ["1","2"],
                            }
                            ]
                            }
                            var ctx = document.getElementById('barchart_salesgraph');
                            var chart = new Chart(ctx, {
                            type:'bar',
                            data: chartData,
                            options: {
                            scaleStartValue: 0,
                            responsive: true,
                            scales: {
                            xAxes: [{
                            ticks:{display: true},
                            gridLines:{display: true},
                            categoryPercentage: 1.0,
                            barPercentage: 0.8,
                            scaleLabel: {
                            display: true,
                            labelString: "Month"
                            },
                            }],
                            yAxes: [{
                            ticks: {
                            beginAtZero: true,
                            display: true
                            },
                            scaleLabel: {
                            display: true,
                            labelString: "Sales"
                            }
                            }]
                            },
                            }
                            ,
                            })});

What's is wrong with this....? can anyone help me... please....
9
General Discussion / Re: ClientEvents Not Working on Modal
Code: [Select]
$('body').on('change keyup input', 'input[name="#ctrl-Jumlah"]', function() {
    jml = $(this).val();
    $('#ctrl-Total').val(jml * 2);
});

This script just trying to simplify your sample code from that link... but still not working....  :( 
11
General Discussion / ClientEvents Not Working on Modal
 I just trying this simple statement for ClientEvents but it is not working.... 

Code: [Select]
$('body').on('change keyup input', 'input[name="#ctrl-Jumlah"]', function() {
    jml = $(this).val();
    $('#ctrl-Total').val(jml * 2);
});