function ir_calculateAmount() {
if (document.calculator.shares_held_enter.value && document.calculator.price_purchase_enter.value && !document.calculator.price_sold_enter.value) {
var initial = document.calculator.shares_held_enter.value*document.calculator.price_purchase_enter.value; var initial_commission = initial*document.calculator.commission_enter.value/100; var initial_vat = initial_commission*document.calculator.vat_enter.value/100; var initial_commissionVat = initial_commission+initial_vat; var initial_net = initial+initial_commissionVat; document.calculator.initial.value = si_formatNumber(initial.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.initial_commissionVat.value = si_formatNumber(initial_commissionVat.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.initial_commission.value = si_formatNumber(initial_commission.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.initial_vat.value = si_formatNumber(initial_vat.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.initial_net.value = si_formatNumber(initial_net.toFixed(2), "###,###,###,###,###,###,###", "");
document.calculator.grosssale.value=''; document.calculator.grosssale_commissionVat.value=''; document.calculator.grosssale_commission.value=''; document.calculator.grosssale_vat.value=''; document.calculator.grosssale_net.value='';
document.calculator.gross_profit.value=''; document.calculator.net_profit.value=''; document.calculator.return_investment.value='';
} else if (document.calculator.shares_held_enter.value && document.calculator.price_sold_enter.value && !document.calculator.price_purchase_enter.value){
var grosssale = document.calculator.shares_held_enter.value*document.calculator.price_sold_enter.value; var grosssale_commission = grosssale*document.calculator.commission_enter.value/100; var grosssale_vat = grosssale_commission*document.calculator.vat_enter.value/100; var grosssale_commissionVat = grosssale_commission+grosssale_vat; var grosssale_net = grosssale-grosssale_commissionVat; document.calculator.grosssale.value = si_formatNumber(grosssale.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.grosssale_commissionVat.value = si_formatNumber(grosssale_commissionVat.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.grosssale_commission.value = si_formatNumber(grosssale_commission.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.grosssale_vat.value = si_formatNumber(grosssale_vat.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.grosssale_net.value = si_formatNumber(grosssale_net.toFixed(2), "###,###,###,###,###,###,###", "");
document.calculator.initial.value=''; document.calculator.initial_commissionVat.value=''; document.calculator.initial_commission.value=''; document.calculator.initial_vat.value=''; document.calculator.initial_net.value=''; document.calculator.gross_profit.value=''; document.calculator.net_profit.value=''; document.calculator.return_investment.value='';
} else if (document.calculator.shares_held_enter.value && document.calculator.price_purchase_enter.value && document.calculator.price_sold_enter.value){
var initial = document.calculator.shares_held_enter.value*document.calculator.price_purchase_enter.value; var initial_commission = initial*document.calculator.commission_enter.value/100; var initial_vat = initial_commission*document.calculator.vat_enter.value/100; var initial_commissionVat = initial_commission+initial_vat; var initial_net = initial+initial_commissionVat;
var grosssale = document.calculator.shares_held_enter.value*document.calculator.price_sold_enter.value; var grosssale_commission = grosssale*document.calculator.commission_enter.value/100; var grosssale_vat = grosssale_commission*document.calculator.vat_enter.value/100; var grosssale_commissionVat = grosssale_commission+grosssale_vat; var grosssale_net = grosssale-grosssale_commissionVat;
var gross_profit = grosssale-initial; var net_profit = grosssale_net-initial_net; var return_investment = 100/initial_net*net_profit;
document.calculator.initial.value = si_formatNumber(initial.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.initial_commissionVat.value = si_formatNumber(initial_commissionVat.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.initial_commission.value = si_formatNumber(initial_commission.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.initial_vat.value = si_formatNumber(initial_vat.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.initial_net.value = si_formatNumber(initial_net.toFixed(2), "###,###,###,###,###,###,###", "");
document.calculator.grosssale.value = si_formatNumber(grosssale.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.grosssale_commissionVat.value = si_formatNumber(grosssale_commissionVat.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.grosssale_commission.value = si_formatNumber(grosssale_commission.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.grosssale_vat.value = si_formatNumber(grosssale_vat.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.grosssale_net.value = si_formatNumber(grosssale_net.toFixed(2), "###,###,###,###,###,###,###", "");
document.calculator.gross_profit.value = si_formatNumber(gross_profit.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.net_profit.value = si_formatNumber(net_profit.toFixed(2), "###,###,###,###,###,###,###", ""); document.calculator.return_investment.value = si_formatNumber(return_investment.toFixed(2), "###,###,###,###,###,###,###", "");
} else {
document.calculator.initial.value=''; document.calculator.initial_commissionVat.value=''; document.calculator.initial_commission.value=''; document.calculator.initial_vat.value=''; document.calculator.initial_net.value='';
document.calculator.grosssale.value=''; document.calculator.grosssale_commissionVat.value=''; document.calculator.grosssale_commission.value=''; document.calculator.grosssale_vat.value=''; document.calculator.grosssale_net.value='';
document.calculator.gross_profit.value=''; document.calculator.net_profit.value=''; document.calculator.return_investment.value='';
} }
function ir_calculateGrowth() { if (document.growth.initial_value.value && document.growth.current_value.value && document.growth.year_investment.value) {
var growth_rate = (Math.pow(document.growth.current_value.value/document.growth.initial_value.value,1/document.growth.year_investment.value))-1; growth_rate = growth_rate*100;
document.growth.growth_rate.value = si_formatNumber(growth_rate.toFixed(2), "###,###,###,###,###,###,###", ""); } else { document.growth.growth_rate.value='';
} }
ราคาล่าสุด
เปลี่ยนแปลง (%)
ปริมาณซื้อขาย (หุ้น)
มูลค่า (‘000 บาท)
ช่วงราคาระหว่างวัน
ช่วงราคาใน 52 สัปดาห์