© 2018 Capita Business Services Ltd. All rights reserved.

Capita Education Software Solutions is a trading name of Capita Business Services Ltd. Our Registered office is 30 Berners Street, London, W1T 3LR and our registered number is 02299747. Further information about Capita plc can be found in our legal statement.

Local - Fees - Transaction Export

We have been asked to show how to automate the collection of fees transactions from SIMS using the Fees Transaction List Report. 

An alternative approach to obtaining similar data is available via the reporting engine see Local - Fees Transactions | ESS Portal (sims-partners.com) for details.

Additional DLLs referenced

  • Fees7Entities.Dll
  • Fees7Processes.Dll

A SIMS login is required before these calls can be made typically with a fees manager permission level.

Calling model

SIMSInterface.TPATransactionListDetail tpld = new SIMSInterface.TPATransactionListDetail();
string JSon = tpld.GetInfo()

Implementation

public class TPATransactionListDetail
{

    SIMS.Processes.FeesBillPayerBrowse payerBrowseProcess = new SIMS.Processes.FeesBillPayerBrowse();
    SIMS.Entities.FeesBillPayerBrowse feesBillPayerBrowse = new SIMS.Entities.FeesBillPayerBrowse();

    public TPATransactionListDetail()
    {
    }
    public string GetInfo()
    { 
        FeesTransactionListDetail feesTransactionListDetail = new FeesTransactionListDetail();

        feesTransactionListDetail.TransactionFromAttribute.Value =
            ((FeesBillingTerm)SIMS.Entities.FeesCache.GetParametersBillingTerms().ItemByIndex(0)).DateCreated;

        feesTransactionListDetail.TransactionToAttribute.Value = DateTime.Now;

        feesTransactionListDetail.PayerSummarys = this.getPayersSummary();
        System.Data.DataSet result = feesTransactionListDetail.Preview();
        string json = JsonConvert.SerializeObject(result, Formatting.Indented);
        return json;


    }
    private void createAndAssignDummyAttributes()
    {
        //feesBillPayerBrowse.SurnameAttribute.Value = "%";
        //feesBillPayerBrowse.ForenameAttribute.Value = "%";
        //feesBillPayerBrowse.PayerRefAttribute.Value = "%";

        FeesPupilStatus objFeesPupiltatus = new FeesPupilStatus(-1, "<Any>", "<Any>", true);
        feesBillPayerBrowse.PupilStatusAttribute.Value = objFeesPupiltatus;
        feesBillPayerBrowse.PayerRefAttribute.Value = "";

        FeesPaymentType paymentTypeAny = new FeesPaymentType();
        paymentTypeAny.Description = "<Any>";
        paymentTypeAny.codeAttribute.Value = Cache.CurrentDatabase.WildcardAny;
        paymentTypeAny.PaymentTypeIDAttribute.Value = -1;
        feesBillPayerBrowse.PaymentTypeAttribute.Value = paymentTypeAny;

        YearGroup yearGroupAny = new YearGroup();
        yearGroupAny.ID = -1;
        yearGroupAny.Description = "<Any>";
        yearGroupAny.Code = Cache.CurrentDatabase.WildcardAny;
        yearGroupAny.Active = "A";
        feesBillPayerBrowse.YearGroupAttribute.Value = yearGroupAny;

        // Extra reg group entities
        RegistrationGroup registrationGroupAny = new SIMS.Entities.RegistrationGroup();
        registrationGroupAny.ID = -1;
        registrationGroupAny.Description = "<Any>";
        registrationGroupAny.Code = Cache.CurrentDatabase.WildcardAny;
        registrationGroupAny.Active = "A";
        feesBillPayerBrowse.RegGroupAttribute.Value = registrationGroupAny;


        Tier objTier = new Tier();
        objTier.ID = -1;
        objTier.Description = "<Any>";
        objTier.Code = Cache.CurrentDatabase.WildcardAny;
        objTier.Active = "A";
        feesBillPayerBrowse.TierAttribute.Value = objTier;

        House objHouse = new House();
        objHouse.ID = -1;
        objHouse.Description = "<Any>";
        objHouse.Code = Cache.CurrentDatabase.WildcardAny;
        objHouse.Active = "A";
        feesBillPayerBrowse.HouseAttribute.Value = objHouse;

        Boarder objBoarder = new Boarder();
        objBoarder.ID = -1;
        objBoarder.Description = "<Any>";
        objBoarder.Code = Cache.CurrentDatabase.WildcardAny;
        objBoarder.Active = "A";
        feesBillPayerBrowse.BoarderStatusAttribute.Value = objBoarder;

        EntityAttribute isACompanyPayer = new EntityAttribute(InformationDomainEnum.None, new AbstractCollectionReference(GetCompany));
        feesBillPayerBrowse.IsACompanyPayerAttribute.Value = GetCompany().ItemByDescription("<Any>");


    }

    private FeesBillPayerSummarys getPayersSummary()
    {
        createAndAssignDummyAttributes();
        payerBrowseProcess.BillPayerBrowse = feesBillPayerBrowse;
        payerBrowseProcess.Search(false);//this will populate BillPayers which is Payers Summery
        return payerBrowseProcess.BillPayerBrowse.BillPayers;
    }

    private static AbstractCollection GetCompany()
    {
        AbstractCollection coll = new AbstractCollection();
        AbstractGroup any = new AbstractGroup(null, -1, "<Any>", "<Any>");
        coll.Add(any);
        AbstractGroup yes = new AbstractGroup(null, 1, "Yes", "Yes");
        coll.Add(yes);
        AbstractGroup no = new AbstractGroup(null, 0, "No", "No");
        coll.Add(no);
        return coll;
    }

}

Example Output

{
  "Table": [
    {
      "payer_transaction_id": 38513,
      "payer_transaction_batch_id": 11162,
      "payer_id": 14437,
      "payer_ref": "A1OIL",
      "payer_name": "A1 Oil Industries",
      "pupil_ref": "DORJ7767",
      "pupil_name": "Dorian, Jon",
      "payerbalance": 32343.760,
      "payment_type": "Cash",
      "batch_number": 175,
      "sequence_no": 167,
      "pupil_id": 7767,
      "transaction_type": "Bills",
      "transaction_date": "2020-09-01T00:00:00",
      "transaction_reference": "Bill-15794",
      "amount": 6453.750,
      "vat_amount": 0.000,
      "OutstandingAmount": 6453.750,
      "allocamount": 0.000,
      "transaction_base_type_id": 2,
      "bfBalance": 6453.750,
      "bfBalanceAllocAmount": 0.000,
      "bfBalanceUnAllocAmount": 6453.750,
      "running_total": "12907.5"
    },