You need to sign in to do that
Don't have an account?
Chandra babu 2
how two su of two column fields and Display the calculated values in another column?
Amount :
Discount :
Net Price:
I need i will give Amount value and Discount values But on UI page Directly calculated that two column fields ,and display the net price total value.
please tel me how to create and display values.
Discount :
Net Price:
I need i will give Amount value and Discount values But on UI page Directly calculated that two column fields ,and display the net price total value.
please tel me how to create and display values.
try this code...
vf page: apex cls :
All Answers
You can a create a custom formula field that will store the calculated price and show it on the Vf page you want just by querying.On page layout remove this field from the page layout.
Thanks .
You can use formula field for the net price like:
For this i created two currency type field Amount and Discount and a formula field Ner Price and the formula field is:
amount__c-(( amount__c * discount__c )/100) and in this you get the net price on the detail UI page.
Suppose that you have 100 rupees Amount and 20 rupees Discount so you get the 80 rupees as the Net Price.
please confirm me you are want this field on the vf page or object UI(page layout).
Apex class
==================
public class purchase
{
public purchase__c purca{get;set;}
public list<purchase__c> getper{get;set;}
public purchase()
{
getper=new list<purchase__c>();
}
public pageReference clas()
{
string M=Apexpages.currentpage().getparameters().get('chand');
getper=[select Name,Amount__c,Discount__c,Net_price1__c from purchase__c where Name=:M];
return null;
}
}
vf page
===================
<apex:page controller="purchase">
<script>
function CalculateAmount()
{
var Price = VALUE(Amount__c);
var Qty = VALUE(Discount__c);
var Amount = Price - Qty;
VALUE(Net_price1__c) = Amount;
}
</script>
<apex:form id="fm">
<apex:pageBlock id="pb">
<apex:pageBlockSection id="pbs" columns="1" >
<apex:inputField id="Price" value="{!purca.Amount__c}" ></apex:inputField>
<apex:inputField id="Sold" value="{!purca.Discount__c}" onkeyup="javascript:CalculateAmount();"> </apex:inputField>
<apex:inputField id="Sale" label="net Price" value="{!purca.Net_price1__c}" onchange="CalculateAmount();"></apex:inputField>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
if you want this result than using the following code:
public class purchase{
public account purca{get;set;}
public list<account> getper{get;set;}
string M=Apexpages.currentpage().getparameters().get('id');
public purchase(){
getper=new list<account>();
getper=[select Name,Amount__c,Discount__c,Net_price__c from account where Amount__c != null];
}
}
<apex:page controller="purchase">
<apex:form >
<apex:repeat value="{!getper}" var="aa">
<apex:outputLabel value="Amount" />
<apex:inputField value="{!aa.amount__c}" id="theValue1" /><br/>
<apex:outputLabel value="Discount"/>
<apex:inputField value="{!aa.discount__c}" id="theValue11"/><br/>
<apex:outputLabel value="Net Price"/>
<apex:outputText value="{!aa.Net_Price__c}" id="theValue1111"/><br/>
</apex:repeat>
</apex:form>
</apex:page>
What is your issue Resolved ??
So don't forget this as a Best Answer..
Thanks Gyani....
try this code...
vf page: apex cls :