Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class TaxReceiptHandler{
- String ReceiptType,ReceiptSelect,rFilter;
- List <Tax_Receipt__c> lst_tax = new List <Tax_Receipt__c>();
- Public Date DateToday {get;set;}
- Public List <Donation_Receipts__c> lst_Receipt {get;set;}
- Public List<ReceiptHeaderWrap> lst_ReceiptHeaderwrap { get; set; }
- Public List<Tax_Receipt__c> lst_ReceiptHeader;
- Public List<Tax_Receipt__c> lst_RectDisplayAll {get;set;}
- public List<Summary> Summaries { get; set; }
- Public Map<Integer,String> map_MonthNoDays;
- Public Map<Integer,String> map_Month;
- Set <String> rheaderId;
- public Boolean refreshPage {get; set;}
- Public String chosenYear{get;set;}
- Public String mailReportType {get;set;}
- public TaxReceiptHandler() {
- }
- public TaxReceiptHandler(ApexPages.StandardController controller) {
- refreshPage=false;
- }
- public String getNewLine() {
- return '\n';
- }
- public String getPrintView() {
- return
- '<!--[if gte mso 9]>' +
- '<xml>' +
- '<w:WordDocument>' +
- '<w:View>Print</w:View>' +
- '<w:Zoom>100</w:Zoom>' +
- '<w:DoNotOptimizeForBrowser/>' +
- '</w:WordDocument>' +
- '</xml>' +
- '<![endif]>';
- }
- public List<SelectOption> getRTypes() {
- List<SelectOption> options = new List<SelectOption>();
- options.add(new SelectOption('GWC','GWC'));
- options.add(new SelectOption('Trust','Trust'));
- return options;
- }
- Public String getReceiptDate() {
- Date recDate;
- String recMonth, recStringDate;
- recDate = System.Today();
- if(recDate.Month() == 1){
- recMonth = 'January';
- }
- else if(recDate.Month() == 2){
- recMonth = 'February';
- }
- else if(recDate.Month() == 3){
- recMonth = 'March';
- }
- else if(recDate.Month() == 4){
- recMonth = 'April';
- }
- else if(recDate.Month() == 5){
- recMonth = 'May';
- }
- else if(recDate.Month() == 6){
- recMonth = 'June';
- }
- else if(recDate.Month() == 7){
- recMonth = 'July';
- }
- else if(recDate.Month() == 8){
- recMonth = 'August';
- }
- else if(recDate.Month() == 9){
- recMonth = 'September';
- }
- else if(recDate.Month() == 10){
- recMonth = 'October';
- }
- else if(recDate.Month() == 11){
- recMonth = 'November';
- }
- else if(recDate.Month() == 12){
- recMonth = 'December';
- }
- recStringDate= recDate.Day()+' '+recMonth +' '+recDate.Year();
- Return recStringDate;
- }
- public string getReceiptType(){
- return null;
- }
- public void setReceiptType(String ReceiptSelect){
- this.ReceiptSelect = ReceiptSelect;
- if(ReceiptSelect == ''){
- rFilter = Null;
- }
- if(ReceiptSelect == 'Trust'){
- rFilter = 'Trust';
- }
- if(ReceiptSelect == 'GWC'){
- rFilter = 'GWC';
- }
- }
- Public List <Tax_Receipt__c> getAllSelectedTaxReceipt(){
- String chosenYearstr,filterstr;
- Integer intYear;
- //chosenYearstr =ApexPages.currentPage().getParameters().get('year');
- //filterstr=ApexPages.currentPage().getParameters().get('filter');
- List <Tax_Receipt__c> lst_tax = new List <Tax_Receipt__c>();
- if(chosenYear != Null){
- if(chosenYear != ''){
- intYear = Integer.valueof(chosenYear);
- mailReportType = rFilter;
- system.debug('***MR***'+ mailReportType);
- lst_tax = [SELECT id,Contact__r.id,Amount_in_Words__c,Contact__r.Name,Certificate_Number__c,YearEnd__c,
- Contact__r.Postal_Street__c,Contact__r.Postal_Street_2__c,Contact__r.Postal_City__c,Contact__r.Postal_State_Province__c,Contact__r.Postal_Code__c,
- Financial_Year_Start__c,Financial_Year_End__c,Total_Receipt_Amount__c FROM Tax_Receipt__c WHERE IsClosed__c=:False AND FISCAL_YEAR(Financial_Year_End__c) =:intYear ];
- }
- }
- Return lst_tax;
- }
- Public void initDateMaps(){
- map_MonthNoDays = new Map<Integer,String>();
- map_MonthNoDays.put(1,'31');
- map_MonthNoDays.put(2,'28');
- map_MonthNoDays.put(3,'31');
- map_MonthNoDays.put(4,'30');
- map_MonthNoDays.put(5,'31');
- map_MonthNoDays.put(6,'30');
- map_MonthNoDays.put(7,'31');
- map_MonthNoDays.put(8,'31');
- map_MonthNoDays.put(9,'30');
- map_MonthNoDays.put(10,'31');
- map_MonthNoDays.put(11,'30');
- map_MonthNoDays.put(12,'31');
- map_Month = new Map<Integer,String>() ;
- map_Month.put(1,'January');
- map_Month.put(2,'February');
- map_Month.put(3,'March');
- map_Month.put(4,'April');
- map_Month.put(5,'May');
- map_Month.put(6,'June');
- map_Month.put(7,'July');
- map_Month.put(8,'August');
- map_Month.put(9,'September');
- map_Month.put(10,'October');
- map_Month.put(11,'November');
- map_Month.put(12,'December');
- }
- Public void displayAllSumRecpt(){
- lst_Receipt = new List<Donation_Receipts__c>();
- lst_Receipt = [Select id,Tax_Receipt__r.id from Donation_Receipts__c where Tax_Receipt__r.id =:apexpages.currentpage().getparameters().get('id')];
- initDateMaps();
- DisplaySumRec();
- SummaryReceipts();
- system.debug('***ReceiptHeaderwrap_1****'+lst_ReceiptHeaderwrap);
- }
- Public void DisplaySumRec(){
- lst_ReceiptHeader = new List<Tax_Receipt__c>();
- DateToday = system.Today();
- rheaderId = new Set <String>();
- for(Donation_Receipts__c r:lst_Receipt){
- rheaderId.add(r.Tax_Receipt__r.id);
- }
- system.debug('**Don_Receipt**'+lst_Receipt+'**Set**'+rheaderId);
- lst_ReceiptHeader = [select id,name,YearEnd__c,Date_closed__c,TodayDate__c,Total_Receipt_Amount__c,Year_end_Words__c,Year_Start_Words__c, Account__r.name,Account__r.Recordtype.name,
- Account__r.BillingCity, Account__r.BillingStreet,Certificate_Number__c, Account__r.BillingState,Account__r.BillingPostalCode,Contact_Donor_Id__c, Account_Donor_Id__c,
- Contact__r.Postal_Street__c,Contact__r.Postal_Street_2__c,Contact__r.Postal_City__c,Contact__r.Postal_State_Province__c,Contact__r.Postal_Code__c,Contact__c,Contact__r.Name,
- (select name from Donation_Receipts__r)
- from Tax_Receipt__c WHERE id in:rheaderId];
- system.debug('**lst_Receipt!!!!**'+lst_ReceiptHeader);
- }
- public void SummaryReceipts(){
- List<receiptWrap> cw;
- lst_ReceiptHeaderwrap = new List<ReceiptHeaderWrap>();
- Map<String,String> map_TaxReceipt;
- map_TaxReceipt = new Map<String,String>();
- AggregateResult[] results = [SELECT Tax_Receipt__c, Calendar_Year(Date__c) year, Calendar_Month(Date__c) month , Sum (Donation_Amount__c) Quantity
- FROM Donation_Receipts__c WHERE Tax_Receipt__c in:rheaderId GROUP BY Tax_Receipt__c,Calendar_Year(Date__c),Calendar_Month(Date__c) ];
- Summaries = new List<Summary>();
- for (AggregateResult ar : results) {
- Summaries.add(new Summary(ar));
- }
- system.debug('**lst_ReceiptHeader**'+lst_ReceiptHeader);
- for(Tax_Receipt__c a:lst_ReceiptHeader){
- map_TaxReceipt.put(a.Name,a.Certificate_Number__c);
- }
- for(Tax_Receipt__c a:lst_ReceiptHeader){
- /*
- cw = new list<receiptWrap>();
- For(Summary s:Summaries){
- s.ofullmonth = map_Month.get(s.oMonth) + ' ' + s.oyear;
- if(s.oname == a.id){
- cw.add(new receiptWrap(s));
- }
- }
- */
- // lst_ReceiptHeaderwrap.add(new ReceiptHeaderWrap(a,false,cw));
- lst_ReceiptHeaderwrap.add(new ReceiptHeaderWrap(a,false));
- }
- }
- Public List <Tax_Receipt__c> getAllCurrentTaxReceipt(){
- Integer intYear;
- List <Tax_Receipt__c> lst_tax = new List <Tax_Receipt__c>();
- if(chosenYear != Null){
- system.debug('***Yearyyyyy***'+chosenYear);
- if(chosenYear != ''){
- intYear = Integer.valueof(chosenYear);
- lst_tax = [SELECT id,Year_end_Words__c,Year_Start_Words__c,Certificate_Number__c, Account__r.name,Account__r.Recordtype.name,
- Account__r.BillingCity, Account__r.BillingStreet, Account__r.BillingState,Account__r.BillingPostalCode,Contact_Donor_Id__c, Account_Donor_Id__c,
- Name,Contact__r.id,Financial_Year_Start__c,Financial_Year_End__c,IsClosed__c,Total_Receipt_Amount__c FROM Tax_Receipt__c WHERE FISCAL_YEAR(Financial_Year_End__c) =:intYear AND IsClosed__c=:False ];
- }
- system.debug('***lst_tax***'+lst_tax);
- }
- Return lst_tax;
- }
- Public List <Tax_Receipt__c> getAllCurrentClosedTaxReceipt(){
- Integer intYear;
- List <Tax_Receipt__c> lst_tax = new List <Tax_Receipt__c>();
- if(chosenYear != null){
- if(chosenYear != ''){
- intYear = Integer.valueof(chosenYear);
- lst_tax = [SELECT id,Name,Contact__r.id,Certificate_Number__c,Account__r.Name,Financial_Year_Start__c,Financial_Year_End__c,IsClosed__c,Total_Receipt_Amount__c FROM Tax_Receipt__c WHERE FISCAL_YEAR(Financial_Year_End__c) =:intYear AND IsClosed__c=:True];
- }
- system.debug('***Year***'+chosenYear);
- }
- Return lst_tax;
- }
- Public void DisplayAllCurrentreceipt(){
- Integer intYear;
- if(chosenYear == ''){
- ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL,'Please type in the Receipt Year');
- ApexPages.addMessage(myMsg);
- }
- }
- Public void CloseAllCurrentreceipt(){
- Integer intYear;
- List <Tax_Receipt__c> lst_tax = new List <Tax_Receipt__c>();
- if(chosenYear == ''){
- ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL,'Please type in the Receipt Year');
- ApexPages.addMessage(myMsg);
- }
- else{
- if(chosenYear != null){
- if(chosenYear != ''){
- intYear = Integer.valueof(chosenYear);
- lst_tax = [SELECT id,Contact__r.id FROM Tax_Receipt__c WHERE FISCAL_YEAR(Financial_Year_End__c) =:intYear AND IsClosed__c=:false];
- for(Tax_Receipt__c tr:lst_tax){
- tr.IsClosed__c=true;
- tr.Date_closed__c = System.Today();
- }
- }
- }
- update lst_tax;
- }
- }
- Public List <Tax_Receipt__c> getIndivTaxReceipt(){
- lst_tax = new List <Tax_Receipt__c>();
- lst_tax = [SELECT id,Contact__r.id,Contact__r.Name,Amount_in_Words__c,Certificate_Number__c,YearEnd__c,Contact__r.FirstName,
- Contact__r.Postal_Street__c,Contact__r.Postal_Street_2__c,Contact__r.Postal_City__c,Contact__r.Postal_State_Province__c,Contact__r.Postal_Code__c,Contact_Donor_Id__c, Account_Donor_Id__c,
- Financial_Year_Start__c,Financial_Year_End__c,Total_Receipt_Amount__c FROM Tax_Receipt__c
- WHERE id =:ApexPages.currentPage().getParameters().get('id')];
- for(Tax_Receipt__c tr:lst_tax){
- // mailReportType = tr.Type__c;
- }
- Return lst_tax;
- }
- Public PageReference PrintAllAggrCurrentreceipt(){
- Integer intYear;
- if(chosenYear == ''){
- ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL,'Please type in the Receipt Year');
- ApexPages.addMessage(myMsg);
- return null;
- }
- intYear = Integer.valueof(chosenYear);
- lst_Receipt = new List<Donation_Receipts__c>();
- lst_Receipt = [Select id,Tax_Receipt__r.id from Donation_Receipts__c where FISCAL_YEAR(Tax_Receipt__r.Financial_Year_End__c) =:intYear AND Tax_Receipt__r.IsClosed__c=:false];
- system.debug('###'+intYear+'###'+lst_Receipt);
- initDateMaps();
- DisplaySumRec();
- SummaryReceipts();
- return new PageReference('/apex/PrintAllTRSum?year='+chosenYear+'&filter='+rFilter);
- }
- Public PageReference PrintAllCurrentreceipt(){
- Integer intYear;
- if(chosenYear == ''){
- ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL,'Please type in the Receipt Year');
- ApexPages.addMessage(myMsg);
- return null;
- }
- intYear = Integer.valueof(chosenYear);
- lst_Receipt = new List<Donation_Receipts__c>();
- lst_Receipt = [Select id,Tax_Receipt__r.id from Donation_Receipts__c where FISCAL_YEAR(Tax_Receipt__r.Financial_Year_End__c) =:intYear AND Tax_Receipt__r.IsClosed__c=:false];
- system.debug('###'+intYear+'###'+lst_Receipt);
- initDateMaps();
- DisplaySumRec();
- SummaryReceipts();
- return new PageReference('/apex/PrintAllTR?year='+chosenYear+'&filter='+rFilter);
- }
- Public PageReference GenenerateIndividual(){
- Id trId = ApexPages.currentPage().getParameters().get('id');
- lst_tax = new List <Tax_Receipt__c>();
- lst_tax = [SELECT id,Contact__r.id,Contact_Donor_Id__c, Account_Donor_Id__c,Contact__r.LastName,Contact__r.FirstName,Receipt_Date__c,Certificate_Number__c,Contact__r.Postal_City__c ,Total_Receipt_Amount__c,Financial_Year_Start__c,Financial_Year_End__c,IsClosed__c FROM Tax_Receipt__c
- WHERE id =:ApexPages.currentPage().getParameters().get('id')];
- for(Tax_Receipt__c tr:lst_tax){
- tr.IsClosed__c=True;
- // mailReportType = tr.Type__c;
- tr.Date_closed__c = system.Today();
- }
- update lst_tax;
- refreshPage=true;
- system.debug('***ReceiptHeaderwrap_2****'+lst_ReceiptHeaderwrap);
- return null;
- }
- //-----------------------RECEIPT INSERTS AND UPDATES
- public Static void returnDates(Map<String,Date> map_fiscalDate,Date OppDate,String AccType){
- //Integer CurrentYear = datetime.now().year();
- Date StartDate, EndDate;
- Integer OppFiscalYear;
- Integer OppMonth;
- Integer Receiptfiscalyear;
- Integer FiscalYearStartMonth;
- String strstart = 'Start', strend = 'end';
- FiscalYearStartMonth = [select FiscalYearStartMonth from Organization where id=:Userinfo.getOrganizationId()].FiscalYearStartMonth;
- OppFiscalYear = OppDate.year();
- OppMonth = OppDate.month();
- if(FiscalYearStartMonth > OppMonth){
- Receiptfiscalyear=OppFiscalYear-1;
- }
- if(FiscalYearStartMonth <= OppMonth){
- Receiptfiscalyear=OppFiscalYear;
- }
- if(AccType == 'Business'){
- if(FiscalYearStartMonth > OppMonth){
- Receiptfiscalyear=OppFiscalYear-1;
- }
- if(FiscalYearStartMonth <= OppMonth){
- Receiptfiscalyear=OppFiscalYear;
- }
- StartDate = date.newInstance(Receiptfiscalyear, FiscalYearStartMonth, 1);
- System.debug('**in business**'+StartDate);
- }
- else{
- if(FiscalYearStartMonth-1 > OppMonth){
- Receiptfiscalyear=OppFiscalYear-1;
- }
- if(FiscalYearStartMonth-1 <= OppMonth){
- Receiptfiscalyear=OppFiscalYear;
- }
- StartDate = date.newInstance(Receiptfiscalyear, FiscalYearStartMonth-1, 1);
- FiscalYearStartMonth = FiscalYearStartMonth-1;
- }
- if(FiscalYearStartMonth-1 == 2){
- EndDate = date.newInstance(Receiptfiscalyear+1, FiscalYearStartMonth-1, 28);
- }
- else{
- EndDate = date.newInstance(Receiptfiscalyear+1, FiscalYearStartMonth-1, 30);
- }
- map_fiscalDate.put(strstart,StartDate);
- map_fiscalDate.put(strend,EndDate);
- system.debug('***111StartDate111***'+StartDate);
- }
- Public static void updateDonationtoTaxReceipt(List <Opportunity> lst_opp){
- List <Donation_Receipts__c> lst_tax = new List <Donation_Receipts__c>();
- Set<String> set_oppid = new set<String>();
- Map<String,Decimal> map_oppamount;
- map_oppamount = new Map<String,Decimal>();
- for(Opportunity o:lst_opp){
- map_oppamount.put(o.id,o.Amount);
- set_oppid.add(o.id);
- }
- lst_tax = [SELECT id,Donation_Name__c FROM Donation_Receipts__c WHERE Donation_Name__r.id in: set_oppid];
- system.debug('**lst_tax**'+lst_tax);
- system.debug('**set_oppid**'+set_oppid);
- for(Donation_Receipts__c tr: lst_tax){
- tr.Donation_Amount__c = map_oppamount.get(tr.Donation_Name__c);
- }
- update lst_tax;
- }
- Public static void addDonationtoTaxReceipt(List <Opportunity> lst_opp){
- List <Tax_Receipt__c> lst_tax = new List <Tax_Receipt__c>();
- List <Account> lst_Account = new List<Account>();
- List <OpportunityContactRole> Lst_ContactRole;
- Map<String,String> map_ConRole;
- Map<String,String> map_AccRtype;
- Map<String,String> map_ContactReceipttrust;
- Map<String,String> map_ReceiptDate;
- Map<String,Date> map_fiscalDate;
- Map<String, String> map_Opptrust;
- Map<String,String> map_emptyrcptdate;
- Map<String,Decimal> map_OppAmount;
- Set<String> set_Accid = new set<String>();
- Set<String> set_Conid;
- Set<String> set_TRemptyopp;
- Set<String> set_oppId;
- Opportunity ind_opp = new Opportunity();
- Donation_Receipts__c ind_rec;
- Boolean taxList;
- Id taxreceipt, contactId, OppId;
- Date StartDate, EndDate;
- Integer OppFiscalYear,OppMonth,Receiptfiscalyear,FiscalYearStartMonth;
- String AccType = 'Business';
- map_Opptrust = new Map<String, String>();
- map_OppAmount = new Map<String,Decimal>();
- map_ReceiptDate = new Map<String,String>();
- FiscalYearStartMonth = [select FiscalYearStartMonth from Organization where id=:Userinfo.getOrganizationId()].FiscalYearStartMonth;
- set_oppId = new Set<String>();
- for(Opportunity o:lst_opp){
- set_Accid.add(o.AccountId);
- set_oppId.add(o.id);
- }
- Lst_ContactRole = new List <OpportunityContactRole>([SELECT ContactId,OpportunityId FROM OpportunityContactRole where OpportunityId in:set_oppId]);
- map_ConRole = new Map<String,String>();
- set_Conid = new Set<String>();
- for(OpportunityContactRole r:Lst_ContactRole){
- map_ConRole.put(r.OpportunityId,r.ContactId);
- set_Conid.add(r.ContactId);
- }
- system.debug('**MAP***'+map_ConRole);
- lst_Account = [SELECT id,RecordType.Name FROM Account WHERE id in:set_Accid];
- map_AccRtype = new Map<String,String>();
- for(Account a: lst_Account){
- map_AccRtype.Put(a.id,a.RecordType.Name);
- }
- system.debug('***map_AccRtype'+map_AccRtype);
- for(Opportunity o:lst_opp){
- if(o.Donation_Status__c == 'Received' && o.ReceiptCount__c == 0){
- map_OppAmount.put(o.id,o.Amount);
- map_Opptrust.put(o.id,o.AccountId);
- system.debug('***map_Opptrust***'+map_Opptrust);
- OppFiscalYear = o.closedate.year();
- OppMonth = o.closedate.month();
- Receiptfiscalyear=OppFiscalYear;
- if(FiscalYearStartMonth > OppMonth){
- Receiptfiscalyear=OppFiscalYear;
- }
- if(FiscalYearStartMonth <= OppMonth){
- Receiptfiscalyear=OppFiscalYear+1;
- }
- /*
- if(map_AccRtype.get(o.Accountid) == 'Business Account'){
- else{
- if(FiscalYearStartMonth-1 > OppMonth){
- Receiptfiscalyear=OppFiscalYear;
- }
- if(FiscalYearStartMonth-1 <= OppMonth){
- Receiptfiscalyear=OppFiscalYear+1;
- }
- */
- map_ReceiptDate.put(o.id,string.valueof(Receiptfiscalyear));
- }
- }
- System.Debug('***set_Accid***'+set_Accid);
- lst_tax = [SELECT id,Contact__r.id,AccountDate__c,Certificate_Number__c,Total_Receipt_Amount__c,Account__c,YearendYear__c,IsClosed__c FROM Tax_Receipt__c WHERE IsClosed__c=:false AND (Account__r.id in:set_Accid OR Contact__r.id in: set_Conid)];
- taxList=false;
- map_ContactReceipttrust = new Map<String,String> ();
- map_emptyrcptdate = new Map<String,String>();
- for(Tax_Receipt__c t:lst_tax){
- if(t.isClosed__c == false){
- map_ContactReceipttrust.put(t.AccountDate__c,t.id);
- map_emptyrcptdate.put(t.AccountDate__c,t.YearendYear__c);
- System.Debug('***Mapp***'+map_emptyrcptdate);
- }
- }
- set_TRemptyopp = new Set<String>();
- for(Opportunity o:lst_opp){
- if(map_ContactReceipttrust.get(o.AccountId) == Null){
- set_TRemptyopp.add(o.id);
- }
- }
- // map_ContactReceipttrust.clear();
- String AccountDate;
- for(Opportunity o:lst_opp){
- if(o.Donation_Status__c == 'Received' && o.ReceiptCount__c == 0){
- // if(set_TRemptyopp.contains(o.id)){
- AccountDate='empty';
- if(map_ReceiptDate.get(o.id) != null){
- if(map_ConRole.get(o.id) == null){
- AccountDate = o.AccountId;
- }
- else{
- AccountDate = map_ConRole.get(o.id);
- }
- AccountDate = AccountDate.substring(0,15)+ map_ReceiptDate.get(o.id);
- }
- System.Debug('***AccountDate**'+ AccountDate + '***'+map_emptyrcptdate.get(AccountDate)+'**'+map_ReceiptDate.get(o.id));
- if(map_emptyrcptdate.get(AccountDate) != Null && map_ReceiptDate.get(o.id)== map_emptyrcptdate.get(AccountDate)){
- ind_rec = new Donation_Receipts__c();
- ind_rec.Donation_Amount__c = o.Amount;
- ind_rec.Donation_Name__c = o.id;
- ind_rec.Tax_Receipt__c = map_ContactReceipttrust.get(AccountDate);
- Insert ind_rec;
- }
- if(map_emptyrcptdate.get(AccountDate) == Null || map_ReceiptDate.get(o.id) != map_emptyrcptdate.get(AccountDate)){
- map_fiscalDate = new Map<String,Date>();
- returnDates(map_fiscalDate,o.closedate,AccType);
- /*
- if(map_AccRtype.get(o.Accountid) == 'Business Account'){
- returnDates(map_fiscalDate,o.closedate,AccType);
- }
- else{
- system.debug('**INDIVID**');
- AccType = 'Individual';
- returnDates(map_fiscalDate,o.closedate,AccType);
- }
- */
- system.debug('***StartDate***'+StartDate);
- Tax_Receipt__c ind_tax = new Tax_Receipt__c();
- system.debug('**MAP***'+map_ConRole.get(o.id));
- if(map_ConRole.get(o.id) == null){
- ind_tax.Account__c = o.AccountId;
- }
- else{
- ind_tax.Contact__c = map_ConRole.get(o.id);
- }
- ind_tax.Financial_Year_Start__c =map_fiscalDate.get('Start');
- ind_tax.Financial_Year_End__c = map_fiscalDate.get('end');
- //----------to be adjusted for accumulated receipts
- //ind_tax.IsClosed__c = true;
- ind_tax.Date_closed__c = system.today();
- Insert ind_tax;
- //adding new receipts to be mapped
- map_ContactReceipttrust.put(ind_tax.AccountDate__c,ind_tax.id);
- map_emptyrcptdate.put(ind_tax.AccountDate__c,ind_tax.YearendYear__c);
- ind_rec = new Donation_Receipts__c();
- ind_rec.Donation_Amount__c = o.Amount;
- ind_rec.Donation_Name__c = o.id;
- ind_rec.Tax_Receipt__c = ind_tax.id;
- Insert ind_rec;
- }
- // o.Receipt_Generated__c = true;
- // }
- }
- }
- updateDonationtoTaxReceipt(lst_opp);
- }
- Public static void UpdateOpponCertificateDelete(List <Opportunity> lst_opp){
- Set<String> set_oppid = new Set<String>();
- Set<String> set_TCid = new Set<String>();
- //Set<String> map_TRtoTC;
- List <Donation_Receipts__c> lst_taxRec;
- List<Tax_Receipt__c> lst_taxCert;
- for(Opportunity o:lst_opp){
- set_oppid.Add(o.id);
- }
- lst_taxRec = new List <Donation_Receipts__c>([SELECT id,Donation_Name__c,Tax_Receipt__c FROM Donation_Receipts__c WHERE Donation_Name__c in: set_oppid]);
- for(Donation_Receipts__c d:lst_taxRec){
- set_TCid.Add(d.Tax_Receipt__c);
- }
- system.debug('&&&'+lst_taxRec);
- delete lst_taxRec;
- lst_taxCert = new List<Tax_Receipt__c>([SELECT id FROM Tax_Receipt__c WHERE id in:set_TCid]);
- system.debug('&&&'+lst_taxCert);
- lst_taxRec = new List <Donation_Receipts__c>([SELECT id,Donation_Name__c,Tax_Receipt__c FROM Donation_Receipts__c WHERE Tax_Receipt__c in: set_TCid]);
- set_TCid.clear();
- for(Donation_Receipts__c d:lst_taxRec){
- set_TCid.Add(d.Tax_Receipt__c);
- }
- for(Tax_Receipt__c t:lst_taxCert){
- if(set_TCid.Contains(t.id) == false){
- delete t;
- }
- }
- }
- Public static void UpdateOpponCertificateDelete(List<Tax_Receipt__c> lst_taxCert){
- Set<String> set_oppid = new Set<String>();
- Set<String> set_TCid = new Set<String>();
- List <Opportunity> lst_opp;
- List <Donation_Receipts__c> lst_taxRec;
- for(Tax_Receipt__c r:lst_taxCert){
- set_TCid.Add(r.id);
- }
- lst_taxRec = new List <Donation_Receipts__c>([SELECT id,Donation_Name__c,Tax_Receipt__c FROM Donation_Receipts__c WHERE Tax_Receipt__c in: set_TCid]);
- for(Donation_Receipts__c d:lst_taxRec){
- set_oppid.Add(d.Donation_Name__c);
- }
- lst_opp = new List <Opportunity>([SELECT id,Donation_Status__c FROM Opportunity WHERE id in:set_oppid]);
- for(Opportunity o:lst_opp){
- o.Donation_Status__c = 'Not Yet Received';
- }
- update lst_opp;
- }
- Public static void UpdateOpponReceiptDelete(List<Donation_Receipts__c> lst_taxRec){
- Set<String> set_oppid = new Set<String>();
- List <Opportunity> lst_opp;
- for(Donation_Receipts__c d:lst_taxRec){
- set_oppid.Add(d.Donation_Name__c);
- }
- lst_opp = new List <Opportunity>([SELECT id,Donation_Status__c FROM Opportunity WHERE id in:set_oppid]);
- for(Opportunity o:lst_opp){
- o.Donation_Status__c = 'Not Yet Received';
- }
- update lst_opp;
- }
- public static void AmountinWordsv2(List<Tax_Receipt__c> lst_taxRec){
- String strfulltext,strDecimal,strNum,strAmtinWords,isZero;
- Boolean OneHthousand;
- Integer len,counter,intRctAmt,isTeen;
- for(Tax_Receipt__c t: lst_taxRec){
- strfulltext = t.Total_Receipt_Amount__c.toPlainString();
- len = strfulltext.length()-3;
- strfulltext = strfulltext.substring(0, len);
- counter = 0;
- strAmtinWords = '';
- for(Integer tmplen=len;tmplen>0;tmplen--){
- strDecimal = strfulltext.substring(counter, len);
- intRctAmt = Integer.valueOf(strDecimal);
- system.debug('**intRctAmt**'+intRctAmt+'**strDecimal**'+strDecimal+'****'+strfulltext.substring(counter, counter+1));
- if(strfulltext.substring(counter, counter+1) == '0' && intRctAmt !=0){
- strDecimal = '';
- strNum = '';
- }
- else{
- if(intRctAmt>999999){
- system.debug('**Mill**'+intRctAmt);
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter, counter+1);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- }
- else if(intRctAmt<1000000 && intRctAmt>99999 ){
- system.debug('**intRctAmt100000**'+intRctAmt);
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter, counter+1);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- if(Integer.valueOf(strfulltext.substring(counter+1, counter+2))==0 && Integer.valueOf(strfulltext.substring(counter+2, counter+3))==0 ){
- strDecimal = strDecimal +' '+ 'Thousand';
- }
- system.debug('*strNum**'+strNum+'**strDecimal*'+strDecimal);
- }
- else if(intRctAmt<100000 && intRctAmt>9999 ){
- isZero = strfulltext.substring(1, 2);
- system.debug('**intRctAmt99999**'+intRctAmt+'*isZero*'+isZero);
- if(len>6 && isZero == '0'){
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter, counter+2);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- if(Integer.valueOf(strfulltext.substring(counter+1, counter+2))!=0){
- if(Integer.valueOf(strfulltext.substring(counter, counter+1))!=1){
- strNum = strNum + ' ' + strDecimalPlace(Integer.valueOf(strfulltext.substring(counter+1, counter+2)));
- }
- }
- }
- else if(len>5 && isZero != '0'){
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter, counter+2);
- intRctAmt = Integer.valueOf(strNum);
- strNum = 'and' +' '+strDecimalPlace(intRctAmt);
- system.debug('**Teen1**'+Integer.valueOf(strfulltext.substring(counter-1, counter)));
- if(Integer.valueOf(strfulltext.substring(counter+1, counter+2))!=0){
- if(Integer.valueOf(strfulltext.substring(counter, counter+1))!=1){
- strNum = strNum + ' ' + strDecimalPlace(Integer.valueOf(strfulltext.substring(counter+1, counter+2)));
- }
- }
- }
- else{
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter, counter+2);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- if(Integer.valueOf(strfulltext.substring(counter+1, counter+2))!=0){
- if(Integer.valueOf(strfulltext.substring(counter, counter+1))!=1){
- strNum = strNum + ' ' + strDecimalPlace(Integer.valueOf(strfulltext.substring(counter+1, counter+2)));
- }
- }
- }
- }
- else if(intRctAmt<10000 && intRctAmt>999){
- system.debug('**intRctAmt1000**'+intRctAmt);
- isZero = strfulltext.substring(1, 2);
- if(len>6 && isZero == '0'){
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter, counter+1);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- if(Integer.valueOf(strfulltext.substring(counter-1, counter))!=0 || Integer.valueOf(strfulltext.substring(counter-1, counter))==1){
- strNum = '';strDecimal = '';
- }
- }
- else{
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter, counter+1);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- // system.debug('**Teen**'+Integer.valueOf(strfulltext.substring(counter-1, counter)));
- if(counter !=0){
- if(Integer.valueOf(strfulltext.substring(counter-1, counter))!=0 || Integer.valueOf(strfulltext.substring(counter-1, counter))==1){
- strNum = '';strDecimal = '';
- }
- }
- }
- }
- else if(intRctAmt<1000 && intRctAmt>99){
- system.debug('**intRctAmt100**'+intRctAmt);
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter, counter+1);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- }
- else if(intRctAmt<100 && intRctAmt>19){
- system.debug('**intRctAmt50**'+intRctAmt);
- if(len>2){
- strDecimal = 'and' +' '+ strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter+1, counter+2);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- if(intRctAmt !=0) {
- strDecimal = strDecimal + ' ' + strNum;
- }
- strNum = '';
- }
- else{
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter+1, counter+2);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- if(intRctAmt !=0) {
- strDecimal = strDecimal + ' ' + strNum;
- }
- strNum = '';
- }
- }
- else if(intRctAmt<20 && intRctAmt>9){
- system.debug('**intRctAmt50**'+intRctAmt);
- if(len>3){
- strDecimal = 'and' +' '+ strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter+1, counter+2);
- strNum = '';
- }
- else{
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter+1, counter+2);
- strNum = '';
- }
- }
- else if(intRctAmt<10 ){
- system.debug('**intRctAmt9**'+intRctAmt);
- if(len>3){
- strDecimal = '';
- strNum = strfulltext.substring(counter, counter+1);
- intRctAmt = Integer.valueOf(strNum);
- strNum = 'and' +' '+strDecimalPlace(intRctAmt);
- if(Integer.valueOf(strfulltext.substring(counter-1, counter))!=0 || intRctAmt ==0) {
- strNum = '';
- }
- }
- else{
- strDecimal = '';
- strNum = strfulltext.substring(counter, counter+1);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- if(counter != 0){
- if(Integer.valueOf(strfulltext.substring(counter-1, counter))!=0 || intRctAmt ==0){
- strNum = '';
- }
- }
- }
- }
- system.debug('*strNum**'+strNum+'**strDecimal*'+strDecimal);
- strAmtinWords = strAmtinWords+ ' ' + strNum + ' '+ strDecimal ;
- }
- counter++;
- }
- strAmtinWords = strAmtinWords + ' ' + 'Rand' + ' ' + 'and';
- //cents
- strfulltext = t.Total_Receipt_Amount__c.toPlainString();
- strNum = '';
- strDecimal = '';
- len = strfulltext.length();
- system.debug('* strfulltext**'+ strfulltext+'**len*'+len);
- isTeen = 2;
- counter = 0;
- for(Integer tmplen=2;tmplen>0;tmplen--){
- isTeen++;
- if(isTeen != 1){
- strDecimal = strfulltext.substring(len-tmplen, len);
- system.debug('* strDecimal**'+strDecimal);
- intRctAmt = Integer.valueOf(strDecimal);
- if(intRctAmt>19 && intRctAmt != 0 ){
- strDecimal = strDecimalPlace(intRctAmt);
- intRctAmt = Integer.valueOf(strfulltext.substring(len-1, len));
- strNum = strDecimalPlace(intRctAmt);
- isTeen = 0;
- }
- else if(intRctAmt<20 && intRctAmt>9 ){
- strDecimal = strDecimalPlace(intRctAmt);
- isTeen = 0;
- }
- else {
- strDecimal = '';
- }
- if(intRctAmt<10){
- if(counter == 0){
- strNum = '';
- }
- else{
- strNum = strfulltext.substring(len-1, len);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- }
- }
- strAmtinWords = strAmtinWords + ' '+ strNum + ' '+ strDecimal ;
- counter++;
- }
- }
- strAmtinWords = strAmtinWords + ' ' + 'cents';
- t.Amount_in_Words__c = strAmtinWords;
- }
- }
- public static void AmountinWordsIndividual(List<Donation_Receipts__c> lst_taxRec){
- String strfulltext,strDecimal,strNum,strAmtinWords,isZero;
- Boolean OneHthousand;
- Integer len,counter,intRctAmt,isTeen;
- for(Donation_Receipts__c t: lst_taxRec){
- strfulltext = t.Donation_Amount__c.toPlainString();
- len = strfulltext.length()-3;
- strfulltext = strfulltext.substring(0, len);
- counter = 0;
- strAmtinWords = '';
- for(Integer tmplen=len;tmplen>0;tmplen--){
- strDecimal = strfulltext.substring(counter, len);
- intRctAmt = Integer.valueOf(strDecimal);
- system.debug('**intRctAmt**'+intRctAmt+'**strDecimal**'+strDecimal+'****'+strfulltext.substring(counter, counter+1));
- if(strfulltext.substring(counter, counter+1) == '0' && intRctAmt !=0){
- strDecimal = '';
- strNum = '';
- }
- else{
- if(intRctAmt>999999){
- system.debug('**Mill**'+intRctAmt);
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter, counter+1);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- }
- else if(intRctAmt<1000000 && intRctAmt>99999 ){
- system.debug('**intRctAmt100000**'+intRctAmt);
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter, counter+1);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- if(Integer.valueOf(strfulltext.substring(counter+1, counter+2))==0 && Integer.valueOf(strfulltext.substring(counter+2, counter+3))==0 ){
- strDecimal = strDecimal+' '+ 'Thousand';
- }
- system.debug('*strNum**'+strNum+'**strDecimal*'+strDecimal);
- }
- else if(intRctAmt<100000 && intRctAmt>9999 ){
- isZero = strfulltext.substring(1, 2);
- system.debug('**intRctAmt99999**'+intRctAmt+'*isZero*'+isZero);
- if(len>6 && isZero == '0'){
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter, counter+2);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- if(Integer.valueOf(strfulltext.substring(counter+1, counter+2))!=0){
- if(Integer.valueOf(strfulltext.substring(counter, counter+1))!=1){
- strNum = strNum + ' ' + strDecimalPlace(Integer.valueOf(strfulltext.substring(counter+1, counter+2)));
- }
- }
- }
- else if(len>5 && isZero != '0'){
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter, counter+2);
- intRctAmt = Integer.valueOf(strNum);
- strNum = 'and' +' '+strDecimalPlace(intRctAmt);
- system.debug('**Teen1**'+Integer.valueOf(strfulltext.substring(counter-1, counter)));
- if(Integer.valueOf(strfulltext.substring(counter+1, counter+2))!=0){
- if(Integer.valueOf(strfulltext.substring(counter, counter+1))!=1){
- strNum = strNum + ' ' + strDecimalPlace(Integer.valueOf(strfulltext.substring(counter+1, counter+2)));
- }
- }
- }
- else{
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter, counter+2);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- if(Integer.valueOf(strfulltext.substring(counter+1, counter+2))!=0){
- if(Integer.valueOf(strfulltext.substring(counter, counter+1))!=1){
- strNum = strNum + ' ' + strDecimalPlace(Integer.valueOf(strfulltext.substring(counter+1, counter+2)));
- }
- }
- }
- }
- else if(intRctAmt<10000 && intRctAmt>999){
- system.debug('**intRctAmt1000**'+intRctAmt);
- isZero = strfulltext.substring(1, 2);
- if(len>6 && isZero == '0'){
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter, counter+1);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- if(Integer.valueOf(strfulltext.substring(counter-1, counter))!=0 || Integer.valueOf(strfulltext.substring(counter-1, counter))==1){
- strNum = '';strDecimal = '';
- }
- }
- else{
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter, counter+1);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- // system.debug('**Teen**'+Integer.valueOf(strfulltext.substring(counter-1, counter)));
- if(counter !=0){
- if(Integer.valueOf(strfulltext.substring(counter-1, counter))!=0 || Integer.valueOf(strfulltext.substring(counter-1, counter))==1){
- strNum = '';strDecimal = '';
- }
- }
- }
- }
- else if(intRctAmt<1000 && intRctAmt>99){
- system.debug('**intRctAmt100**'+intRctAmt);
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter, counter+1);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- }
- else if(intRctAmt<100 && intRctAmt>19){
- system.debug('**intRctAmt50**'+intRctAmt);
- if(len>2){
- strDecimal = 'and' +' '+ strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter+1, counter+2);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- if(intRctAmt !=0) {
- strDecimal = strDecimal + ' ' + strNum;
- }
- strNum = '';
- }
- else{
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter+1, counter+2);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- if(intRctAmt !=0) {
- strDecimal = strDecimal + ' ' + strNum;
- }
- strNum = '';
- }
- }
- else if(intRctAmt<20 && intRctAmt>9){
- system.debug('**intRctAmt50**'+intRctAmt);
- if(len>3){
- strDecimal = 'and' +' '+ strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter+1, counter+2);
- strNum = '';
- }
- else{
- strDecimal = strDecimalPlace(intRctAmt);
- strNum = strfulltext.substring(counter+1, counter+2);
- strNum = '';
- }
- }
- else if(intRctAmt<10 ){
- system.debug('**intRctAmt9**'+intRctAmt);
- if(len>3){
- strDecimal = '';
- strNum = strfulltext.substring(counter, counter+1);
- intRctAmt = Integer.valueOf(strNum);
- strNum = 'and' +' '+strDecimalPlace(intRctAmt);
- if(Integer.valueOf(strfulltext.substring(counter-1, counter))!=0 || intRctAmt ==0) {
- strNum = '';
- }
- }
- else{
- strDecimal = '';
- strNum = strfulltext.substring(counter, counter+1);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- if(counter != 0){
- if(Integer.valueOf(strfulltext.substring(counter-1, counter))!=0 || intRctAmt ==0){
- strNum = '';
- }
- }
- }
- }
- system.debug('*strNum**'+strNum+'**strDecimal*'+strDecimal);
- strAmtinWords = strAmtinWords+ ' ' + strNum + ' '+ strDecimal ;
- }
- counter++;
- }
- strAmtinWords = strAmtinWords + ' ' + 'Rand' + ' ' + 'and';
- //cents
- strfulltext = t.Donation_Amount__c.toPlainString();
- strNum = '';
- strDecimal = '';
- len = strfulltext.length();
- system.debug('* strfulltext**'+ strfulltext+'**len*'+len);
- isTeen = 2;
- counter = 0;
- for(Integer tmplen=2;tmplen>0;tmplen--){
- isTeen++;
- if(isTeen != 1){
- strDecimal = strfulltext.substring(len-tmplen, len);
- system.debug('* strDecimal**'+strDecimal);
- intRctAmt = Integer.valueOf(strDecimal);
- if(intRctAmt>19 && intRctAmt != 0 ){
- strDecimal = strDecimalPlace(intRctAmt);
- intRctAmt = Integer.valueOf(strfulltext.substring(len-1, len));
- strNum = strDecimalPlace(intRctAmt);
- isTeen = 0;
- }
- else if(intRctAmt<20 && intRctAmt>9 ){
- strDecimal = strDecimalPlace(intRctAmt);
- isTeen = 0;
- }
- else {
- strDecimal = '';
- }
- if(intRctAmt<10){
- if(counter == 0){
- strNum = '';
- }
- else{
- strNum = strfulltext.substring(len-1, len);
- intRctAmt = Integer.valueOf(strNum);
- strNum = strDecimalPlace(intRctAmt);
- }
- }
- strAmtinWords = strAmtinWords + ' '+ strNum + ' '+ strDecimal ;
- counter++;
- }
- }
- strAmtinWords = strAmtinWords + ' ' + 'cents';
- t.Amount_in_Words__c = strAmtinWords;
- }
- }
- Public static String strDecimalPlace(Integer intPlace){
- String decimalValue;
- system.debug('**intPlace*'+intPlace);
- String numberValue;
- if(intPlace == 0){
- decimalValue = 'Zero';
- return decimalValue;
- }
- if(intPlace == 1){
- decimalValue = 'One';
- return decimalValue;
- }
- if(intPlace == 2){
- decimalValue = 'Two';
- return decimalValue;
- }
- if(intPlace == 3){
- decimalValue = 'Three';
- return decimalValue;
- }
- if(intPlace == 4){
- decimalValue = 'Four';
- return decimalValue;
- }
- if(intPlace == 5){
- decimalValue = 'Five';
- return decimalValue;
- }
- if(intPlace == 6){
- decimalValue = 'Six';
- return decimalValue;
- }
- if(intPlace == 7){
- decimalValue = 'Seven';
- return decimalValue;
- }
- if(intPlace == 8){
- decimalValue = 'Eight';
- return decimalValue;
- }
- if(intPlace == 9){
- decimalValue = 'Nine';
- return decimalValue;
- }
- if(intPlace == 10){
- decimalValue = 'Ten';
- return decimalValue;
- }
- if(intPlace == 11){
- decimalValue = 'Eleven';
- return decimalValue;
- }
- if(intPlace == 12){
- decimalValue = 'Twelve';
- return decimalValue;
- }
- if(intPlace == 13){
- decimalValue = 'Thirteen';
- return decimalValue;
- }
- if(intPlace == 14){
- decimalValue = 'Fourteen';
- return decimalValue;
- }
- if(intPlace == 15){
- decimalValue = 'Fifteen';
- return decimalValue;
- }
- if(intPlace == 16){
- decimalValue = 'Sixteen';
- return decimalValue;
- }
- if(intPlace == 17){
- decimalValue = 'Seventeen';
- return decimalValue;
- }
- if(intPlace == 18){
- decimalValue = 'Eighteen';
- return decimalValue;
- }
- if(intPlace == 19){
- decimalValue = 'Nineteen';
- return decimalValue;
- }
- if(intPlace >= 20 && intPlace < 30){
- decimalValue = 'Twenty';
- return decimalValue;
- }
- if(intPlace >= 30 && intPlace < 40){
- decimalValue = 'Thirty';
- return decimalValue;
- }
- if(intPlace >= 40 && intPlace < 50){
- decimalValue = 'Forty';
- return decimalValue;
- }
- if(intPlace >= 50 && intPlace < 60){
- decimalValue = 'Fifty';
- return decimalValue;
- }
- if(intPlace >= 60 && intPlace < 70){
- decimalValue = 'Sixty';
- return decimalValue;
- }
- if(intPlace >= 70 && intPlace < 80){
- decimalValue = 'Seventy';
- return decimalValue;
- }
- if(intPlace >= 80 && intPlace < 90){
- decimalValue = 'Eighty';
- return decimalValue;
- }
- if(intPlace >= 90 && intPlace < 100){
- decimalValue = 'Ninety';
- return decimalValue;
- }
- if(intPlace >= 100 && intPlace <= 999){
- decimalValue = 'Hundred';
- return decimalValue;
- }
- if(intPlace >= 1000 && intPlace < 100000){
- decimalValue = 'Thousand';
- return decimalValue;
- }
- if(intPlace > 99999 && intPlace < 1000000){
- decimalValue = 'Hundred';
- return decimalValue;
- }
- if(intPlace > 999999){
- decimalValue = 'Million';
- return decimalValue;
- }
- return null;
- }
- public class ReceiptHeaderWrap{
- public Tax_Receipt__c oTaxReceipt{get;set;}
- public boolean isSelected{get;set;}
- // public List<receiptWrap> receiptset{get;set;}
- public ReceiptHeaderWrap(Tax_Receipt__c a,boolean b /* List<receiptWrap> c */ ){
- oTaxReceipt=a;
- isSelected=b;
- // receiptset=c;
- }
- }
- public class receiptWrap{
- public Donation_Receipts__c oReceipt{get;set;}
- public boolean isSelected{get;set;}
- public Summary oSummary {get; set;}
- public receiptWrap(Summary a){
- oSummary=a;
- isSelected=false;
- }
- }
- public class Summary {
- public Decimal oQuantity { get; private set; }
- public String oName { get; private set; }
- public Decimal oYear { get; private set; }
- public Integer oMonth { get; private set; }
- public String ofullmonth {get; private set;}
- public Summary(AggregateResult ar) {
- oQuantity = (Decimal) ar.get('Quantity');
- oName = (String) ar.get('Tax_Receipt__c');
- oYear = (Decimal) ar.get('Year');
- oMonth = (Integer) ar.get('Month');
- }
- }
- }
Add Comment
Please, Sign In to add comment