You need to sign in to do that
Don't have an account?
SFDC Dummy
How to display alert message:urgent
Hi All
I have created a Vf page for trial the balance.i want to dispaly a alert message when debit and credit balance not same and now debit balance showing 0.0 format i want to display that in 0.00 format like credi balance how to chnage that for my requirment
I have created a Vf page for trial the balance.i want to dispaly a alert message when debit and credit balance not same and now debit balance showing 0.0 format i want to display that in 0.00 format like credi balance how to chnage that for my requirment
<apex:page docType="html-5.0" standardController="MasterCopy__c" extensions="dateInPBTbaleControllernewOk" showHeader="false" sidebar="false"> <apex:pageMessages id="showmsg" ></apex:pageMessages> <style type="text/css" media="print"> @media print { #non-printable { display: none; } #printable { display: block; width: 100%; height: 100%; } } </style> <apex:define name="body"> <div style="width:800px;margin: 0px auto 10px auto;border: 1px solid black;"> <apex:form id="tableId"> <apex:pageBlock > <b><apex:outputLabel value="Trial Balance Report On: " style="font-weight: bold;color:red;"/></b> <apex:inputField value="{!account.Date__c}" style="font-weight: bold;color:red;"/> <!--- Trial Balance Report On: <apex:input type="date" value="{!dat}"/>--> <apex:commandButton value="Display" action="{!displaingTable}" reRender="tableId" style="font-weight: bold;color:red;" oncomplete="window.opener.location.refresh();" /> <b><apex:commandLink id="printable" onclick="JavaScript:window.print();" value="Print"/></b> <br/><br/><br/> <apex:pageblockTable value="{!listAccount }" var="record" > <apex:column value="{!record.Master_Code__c}" headerValue="Master Code"/> <apex:column value="{!record.Master_Name__c}" headerValue="Master Name"> <apex:facet name="footer" > <apex:outputText value="HDFC CLOSING BALANCE: Rs.{0, number, ###,###,###,##0.00}" style="font-weight: bold;color:green;font-size:12px;height=18px;" > <apex:param value="{!totalRevenuee}" /> </apex:outputText> </apex:facet> </apex:column> <apex:column value="{!record.New_Debit__c}" headerValue="Debit(+)" style="color:green;" > <apex:facet name="footer" > <apex:outputText value=" Rs.{!totalRevenue}<br/> Rs.{!totalRevenuee}<br/>-----------------<br/> Rs.{!totalRevenuee1}" style="font-weight: bold;color:green;font-size:12px;height=18px;" escape="false"> </apex:outputText> </apex:facet> </apex:column> <apex:column value="{!record.New_Credit__c}" headerValue="Credit(-)" style="color:red;" > <apex:facet name="footer" > <apex:outputText value="Rs.{!totalRevenue1}" style="font-weight: bold;color:red;font-size:12px;height=18px;" > </apex:outputText> </apex:facet> </apex:column> <!--- <td style="background-color: #DAFFFF" ><b> <apex:outputText value="Current Total" /></b></td> <apex:column value="{!record.Bank_Closing_Balance__c}" headerValue="Bank Closing Balance" style="color:green;"> <apex:facet name="footer" > <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}" style="font-weight: bold;color:green;font-size:12px;height=18px;" > <apex:param value="{!totalRevenuee}" /> </apex:outputText> </apex:facet> </apex:column>--> </apex:pageblockTable> </apex:pageBlock> </apex:form> </div> </apex:define> </apex:page> ------------------------------------------------------------------------------------------------- public with sharing class dateInPBTbaleControllernewOk { public MasterCopy__c account{get;set;} public List<MasterCopy__c> listAccount {get;set;} public Double totalRevenue {get;set;} public Double totalRevenue1 {get;set;} public Double totalRevenuee {get;set;} public Double totalRevenuee1 {get;set;} public Date dat {get;set;} public Map<Date,List<MasterCopy__c>> mapOfDateWithEntry; public dateInPBTbaleControllernewOk(ApexPages.StandardController controller){ account = new MasterCopy__c(); totalRevenue = 0; totalRevenue1 = 0; totalRevenuee = 0; totalRevenuee1 = 0; } public void setValues(){ listAccount = new List<MasterCopy__c>([SELECT id, Closing_Balance__c,Credit__c,Credit_Formula__c,Debit_Formula__c,Date__c,DateUpdate__c,Debit__c, Group__c,Master_Code__c,Master_Name__c,New_Debit__c,New_Credit__c FROM MasterCopy__c order by Master_Code__c ASC ]); mapOfDateWithEntry = new Map<Date,List<MasterCopy__c>>(); List<MasterCopy__c> listOfEntryData; for(MasterCopy__c entry : listAccount){ if(mapOfDateWithEntry.containsKey(entry.Date__c)){ mapOfDateWithEntry.get(entry.Date__c).add(entry); } else{ listOfEntryData = new List<MasterCopy__c>(); listOfEntryData.add(entry); mapOfDateWithEntry.put(entry.Date__c,listOfEntryData); } } calculateTotalRevenue(); calculateTotalRevenue1(); calculateTotalRevenue2(); } public void displaingTable(){ setValues(); if(account.Date__c != null){ totalRevenue = 0; totalRevenue1 = 0; totalRevenuee = 0; totalRevenuee1 = 0; Set<Date> allDateSet = mapOfDateWithEntry.keySet(); if(allDateSet.contains(account.Date__c)){ listAccount = mapOfDateWithEntry.get(account.Date__c); } else { Date compareDate ; Integer count = 0; for(Date firstKeydate : allDateSet){ compareDate = firstKeydate; break; } for(Date keyDate : allDateSet){ if(keydate < account.Date__c && keydate > compareDate){ compareDate = keyDate; } if(account.Date__c < keyDate){ count ++ ; } } Date requiredDate ; if(allDateSet.size() == count){ requiredDate = [Select Date__c from MasterCopy__c Order by Date__c Desc LIMIT 1][0].Date__c; } else { requiredDate = compareDate; } listAccount = mapOfDateWithEntry.get(requiredDate); } } calculateTotalRevenue(); calculateTotalRevenue1(); calculateTotalRevenue2(); } public void calculateTotalRevenue() { for(MasterCopy__c acct2 : listAccount) { if(acct2.Closing_Balance__c!= null) totalRevenuee= acct2.Closing_Balance__c; } for(MasterCopy__c acct : listAccount) { if(acct.New_Debit__c!= null) totalRevenue+= acct.New_Debit__c; } totalRevenuee1=totalRevenuee+totalRevenue; } public void calculateTotalRevenue2() { for(MasterCopy__c acct2 : listAccount) { if(acct2.Closing_Balance__c!= null) totalRevenuee= acct2.Closing_Balance__c; } } public void calculateTotalRevenue1() { for(MasterCopy__c acct1 : listAccount) { if(acct1.New_Credit__c!= null) totalRevenue1+= acct1.New_Credit__c; } } }
I am reading the footer values and comparing them, if it doesnt match then i am throwning the pagemessage.
Please let me know if you need any other help
Thanks,
Pramodh.