public static bool DoWeHaveEnoughMoney(XeroCoreApi coreClient, PayRun payRun) { // The only way to get the balance in Xero is from the reports Api var report = coreClient.Reports.BalanceSheet(DateTime.Today); var balanceStr = report.Rows[2].Rows[0].Cells[1].Value; var balance = decimal.Parse(balanceStr); return(Math.Abs(balance) >= payRun.Wages); }
public static void CreateNewPayrun(AustralianPayroll payrollClient) { // Create a payrun using a calendar, in our case a fortnight calendar var calendar = GetPayrollCalendar(payrollClient); var newPayrun = new PayRun { PayrollCalendarId = calendar.Id }; payrollClient.PayRuns.Create(newPayrun); }
public static void Pay(AustralianPayroll payrollClient, PayRun payrun) { // Complete Payrun payrun.PayRunStatus = PayRunStatus.Posted; payrollClient.PayRuns.Update(payrun); }