Local - Fees Balances
There may be a requirement to get current balances for students in fees and or a bill payer.
Sample code from Local - SIMS 7 Fees Example Code | ESS Portal (sims-partners.com) shows how this can be achieved.
Using command reporter to run it, see Local API - Hello World (Read Only) | ESS Portal (sims-partners.com) for instructions on how to code the solution. This will look something like this when you've re-used the sample code.
public static FeesBalanceSuperStarReport GetBalances(string Server, string Database, string User, string Password)
{
XmlDocument d = SIMSReportingEngine.ReportingEngine.Run("CMS - Student Payer Balances", Server, Database, User, Password);
XmlSerializer serializer = new XmlSerializer(typeof(FeesBalanceSuperStarReport));
FeesBalanceSuperStarReport balances = null;
using (StringReader reader = new StringReader(d.InnerXml))
{
balances = (FeesBalanceSuperStarReport)serializer.Deserialize(reader);
}
return balances;
}
The report generates a document
<SuperStarReport>
<Record>
<multiple_id>12337,12260</multiple_id>
<StudentID>12337</StudentID>
<PupilReference>PARKSP</PupilReference>
<ExternalId>6fca7a6a-7597-4ef5-ad5b-fd9ab2273688</ExternalId>
<Payer_Outstanding_Balance>10900.00</Payer_Outstanding_Balance>
<Pupil_Payer_Outstanding_Balance>10900.00</Pupil_Payer_Outstanding_Balance>
<PayerReference>PARK4854</PayerReference>
</Record>
<Record>
<multiple_id>11827,11795</multiple_id>
<StudentID>11827</StudentID>
<PupilReference>Pottsi</PupilReference>
<ExternalId>23314cd4-f20b-46ff-b83d-d1389f94a68d</ExternalId>
<Payer_Outstanding_Balance>10900.00</Payer_Outstanding_Balance>
<Pupil_Payer_Outstanding_Balance>10900.00</Pupil_Payer_Outstanding_Balance>
<PayerReference>POTT3383</PayerReference>
</Record>
</SuperStarReport>
This can be deserialized in to:
[XmlRoot(ElementName = "Record")]
public class FeesBalanceRecord
{
/// <summary>
/// The internal ID of the student
/// </summary>
[XmlElement(ElementName = "StudentID")]
public int StudentID { get; set; }
/// <summary>
/// The Fees reference for a student
/// </summary>
[XmlElement(ElementName = "PupilReference")]
public string PupilReference { get; set; }
/// <summary>
/// The external ID of the student
/// </summary>
[XmlElement(ElementName = "ExternalId")]
public string ExternalId { get; set; }
/// <summary>
/// The outstanding balance for the bill payer who may have many pupils to pay for.
/// </summary>
[XmlElement(ElementName = "Payer_Outstanding_Balance")]
public double? PayerOutstandingBalance { get; set; }
/// <summary>
/// The outstanding balance for that biil payer for this specifc student. The total debt for the the student could be the sum of
/// many payers
/// </summary>
[XmlElement(ElementName = "Pupil_Payer_Outstanding_Balance")]
public double? PupilPayerOutstandingBalance { get; set; }
/// <summary>
/// The payer reference -NB: there is no access to internal / external id in the reporting model at this time.
/// We can however produce a report of external id, internal id & Payer Ref if
/// </summary>
[XmlElement(ElementName = "PayerReference")]
public string PayerReference { get; set; }
}
Please note that there is more than one concept of a balance. This report is mainly designed to provide a per payer per student balance. So if Mum and Dad pay half each the student will get 2 records. If Mrs Miggins has 2 students at the school then she will have a record for each child at the school. Payers may be outside of family and may have many pupils to contribute to and will have as many records as the pupils for whom they contribute.
There is however sufficient information in the report to present student or bill payer balances with a small amount of arithmetic.