Previous Month Data(Opening Balance) Auto saving in the current month data entry form

Hi Experts,

I am getting the previous month data(Opening balance) in the data entry screen for logistics implementation but can’t save those data without changing these cells. I have tried as bellow:

Way-1: Changing the key of one field and calling saveVal() function

$(document).on(“change, keyup”, “#yQfHIwxvCmb-dCWAvZ8hcrs-val”, saveVal( ‘ta8v9gj6aQC’, ‘dCWAvZ8hcrs’, true));

Way-2: Changing another field that is affecting to the previous month data field

function changeVal(){

var varBL= $(’#ta8v9gj6aQC-dCWAvZ8hcrs-val).val();
var total=(varBL)*1;
$(’#ta8v9gj6aQC-dCWAvZ8hcrs-val).val(total);
}

$(document).on(“change, keyup”, “#yQfHIwxvCmb-dCWAvZ8hcrs-val”, changeVal());

Way-3: Using dhis2.de.event.dataValueSaved

dhis2.util.on( ‘dhis2.de.event.dataValueSaved’, function( event, ds, dv ) {
saveVal( ‘ta8v9gj6aQC’, ‘dCWAvZ8hcrs’, true);
// alert( 'Data value: ’ + dv.value + ’ was saved with data element: ’ + dv.de );
} );

Way-4: Button Based
$("#saveBtn").click(function(){
saveVal( ‘ta8v9gj6aQC’, ‘dCWAvZ8hcrs’, true);
});

Save Opening Balance

Please check the attachment for more details.

Can any1 help me?

Thanks

Julhas Sujan

Dhaka, Bangladesh