column and row wise total calculation with array in php or joomla custom component with jQuery


ashwin vasava

IN Html section


<script>

$(document).ready(function() {

$(“input”).click(function(event) {

var id = $(this).closest(‘td’).attr(‘id’);
// alert(id);
var menuid = id.replace(“menu_”,””);
updateTotal(menuid);
});

//    multiplyer
$(“input[name=’multiplyer[]’]”).blur(function(event) {
var value = $(this).val();
//alert(value);
var textid = $(this).attr(‘id’);
var multiplyerid = textid.replace(“multiplyer_”,””);
var parentpriece =  $(‘#parentprice_’+multiplyerid).val();
var ttto = parentpriece*value;
var id = $(this).closest(‘td’).attr(‘id’);
// alert(id);
var menuid = id.replace(“menu_”,””);
//$(‘#totalprice’+menuid).val(ttto.toFixed(2));
$(‘#docfile’+multiplyerid).val(multiplyerid+’_’+ttto+’_’+value);
$(“#”+textid).click();
});

$(“input[name=’multiplyer[]’]”).click(function(event) {
var value = $(this).val();
//alert(value);
var textid = $(this).attr(‘id’);
var multiplyerid = textid.replace(“multiplyer_”,””);
var parentpriece =  $(‘#parentprice_’+multiplyerid).val();
var ttto = parentpriece*value;
var id = $(this).closest(‘td’).attr(‘id’);
// alert(id);
var menuid = id.replace(“menu_”,””);
//$(‘#totalprice’+menuid).val(ttto.toFixed(2));
$(‘#docfile’+multiplyerid).val(multiplyerid+’_’+ttto+’_’+value);
$(‘#multi_’+multiplyerid).text(ttto);
//select_price(multiplyerid,value);
$(“#”+textid).focus();
});

});

function updateTotal(id) {
//alert(id);
var total = 0;
var url = ”;
var multi = ”;
var nnn= 0;
$(“#menu_”+id+” input:checked”).each(function() {
var mainval = this.value;
var priceval = mainval.split(“_”);;
//alert(priceval[2]*priceval[1]);
//alert(priceval[1]);
total += parseFloat(priceval[1]);
url = url + ‘&’ + priceval[0];
multi = multi + ‘&’…

View original post 404 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s