let owner_shares = $('.owner_shares').val(); let amt = 0; let arrlength = 1; let arr = document.getElementsByName('owner_shares'); let owner_name = document.getElementsByName('owner_name'); let owner_profit = document.getElementsByName('owner_profit'); let total_cost = $('#total_sales').val(); let fixed_cost = $('#fixed_cost').val(); let urgent_cost = $('#urgent_cost').val(); let target_sales = $('#target_sales').val(); let arrOwnerShare = []; let arrOwnerName = []; let arrOwnerProfit = []; for(let index = 0; index < arr.length; index++){ let shares = arr[index].value; arrOwnerShare.push(shares); let owner_names = owner_name[index].value; arrOwnerName.push(owner_names); let owner_profits = owner_profit[index].value; arrOwnerProfit.push(owner_profits); } var arrOwnerShareString = JSON.stringify(arrOwnerShare); var arrOwnerNameString = JSON.stringify(arrOwnerName); var arrOwnerProfitString = JSON.stringify(arrOwnerProfit); $.ajax({ type: 'POST', url: 'save_month_data', data: {total_sales: total_cost, fixed_cost: fixed_cost, month: valuemonthSelected, year: valueyearSelected, urgent_cost: urgent_cost, target_sales: target_sales, owner_profit: arrOwnerProfitString, authid: authid, shares: arrOwnerShareString, owner_names: arrOwnerNameString, _token: '{{csrf_token()}}'}, success: function(data){ if(data.msg == 'True'){ if(data.entry>0){ setTimeout(function() { $('#msg').show(); $('#msgs').text('Data Submitted Successfully !'); $('.save_records').text('Update'); }, 500); } else{ setTimeout(function() { $('#msg').show(); $('#msgs').text('Data Inserted Successfully !'); $('.save_records').text('Save'); }, 500); } } } }); }); }); let owner_shares = $('.owner_shares').val(); let amt = 0; let arrlength = 1; let arr = document.getElementsByName('owner_shares'); let owner_name = document.getElementsByName('owner_name'); let owner_profit = document.getElementsByName('owner_profit'); let total_cost = $('#total_sales').val(); let fixed_cost = $('#fixed_cost').val(); let urgent_cost = $('#urgent_cost').val(); let target_sales = $('#target_sales').val(); let arrOwnerShare = []; let arrOwnerName = []; let arrOwnerProfit = []; for(let index = 0; index < arr.length; index++){ let shares = arr[index].value; arrOwnerShare.push(shares); let owner_names = owner_name[index].value; arrOwnerName.push(owner_names); let owner_profits = owner_profit[index].value; arrOwnerProfit.push(owner_profits); } var arrOwnerShareString = JSON.stringify(arrOwnerShare); var arrOwnerNameString = JSON.stringify(arrOwnerName); var arrOwnerProfitString = JSON.stringify(arrOwnerProfit); $.ajax({ type: 'POST', url: 'save_month_data', data: {total_sales: total_cost, fixed_cost: fixed_cost, month: valuemonthSelected, year: valueyearSelected, urgent_cost: urgent_cost, target_sales: target_sales, owner_profit: arrOwnerProfitString, authid: authid, shares: arrOwnerShareString, owner_names: arrOwnerNameString, _token: '{{csrf_token()}}'}, success: function(data){ if(data.msg == 'True'){ if(data.entry>0){ setTimeout(function() { $('#msg').show(); $('#msgs').text('Data Submitted Successfully !'); $('.save_records').text('Update'); }, 500); } else{ setTimeout(function() { $('#msg').show(); $('#msgs').text('Data Inserted Successfully !'); $('.save_records').text('Save'); }, 500); } } } }); }); });
