So now, I have some fake accounts I generated from microaccounts.uk, and I have some real accounts, computations and a tax return that I submitted last year, which all appears to be ixbrl.
I can therefore break this up into pieces and include the relevant portions in the relevant spots in the submission, right?
Breaking it up was easy enough. I now have two files called accounts-section.xml and comps-section.xml (you can't see these because, again, it has private information in it). I can put these files in the relevant spots in the IRenvelope struct and then, hopefully, everything will work.
Sadly not. In our pursuit of trying to get something to work, we have only worked with the Accounts attachment, so now we need to allow both computations and accounts to be submitted, and, what's more, we need to submit them in that order (which seems backwards to me) in order to match the schema.
func (ire *IRenvelope) AsXML() any {Here, we removed the XBRLsubmission element, because that is now part of the attachments element returned from figureAttachments:
if ire.NoAccountsReason == "" && ire.AccountsIXBRL == "" {
log.Fatalf("Must give accounts or a reason not to")
}
if ire.NoAccountsReason != "" && ire.AccountsIXBRL != "" {
log.Fatalf("Must EITHER give accounts OR a reason not to")
}
if ire.NoComputationsReason == "" && ire.ComputationIXBRL == "" {
log.Fatalf("Must give computations or a reason not to")
}
if ire.NoComputationsReason != "" && ire.ComputationIXBRL != "" {
log.Fatalf("Must EITHER give computations OR a reason not to")
}
keys := ElementWithNesting("Keys", Key("UTR", ire.UTR))
pe := ElementWithText("PeriodEnd", ire.PeriodEnd)
dc := ElementWithText("DefaultCurrency", "GBP")
manifest := ElementWithNesting("Manifest",
ElementWithNesting("Contains",
ElementWithNesting("Reference",
ElementWithText("Namespace", "http://www.govtalk.gov.uk/taxation/CT/5"),
ElementWithText("SchemaVersion", "2022-v1.99"),
ElementWithText("TopElementName", "CompanyTaxReturn"),
)))
irh := ElementWithNesting("IRheader", keys, pe, dc, manifest)
irh.Elements = append(irh.Elements, ElementWithText("Sender", ire.Sender))
ci := ElementWithNesting("CompanyInformation", companyInfo(ire.Business, ire.UTR, ire.PeriodStart, ire.PeriodEnd))
summary := ElementWithNesting("ReturnInfoSummary", ire.accounts(), ire.computations())
turnover := ElementWithNesting("Turnover", ElementWithText("Total", fmt.Sprintf("%.2f", ire.Turnover)))
calc := ElementWithNesting("CompanyTaxCalculation", ire.taxCalc())
too := ElementWithNesting("CalculationOfTaxOutstandingOrOverpaid", ire.cotoo())
decl := ElementWithNesting("Declaration", decl())
attachments := ire.figureAttachments()
var attach any
if attachments != nil {
attach = ElementWithNesting("AttachedFiles", attachments)
}
ctr := MakeCompanyTaxReturn(ire.ReturnType, ci, summary, turnover, calc, too, decl, attach)
return MakeIRenvelopeMessage(irh, ctr)
}
func (ire *IRenvelope) figureAttachments() []any {
ret := []any{}
if ire.ComputationIXBRL != "" {
cxml := ElementWithNesting("Computation", ElementWithNesting("Instance", ContentFromFile("InlineXBRLDocument", ire.ComputationIXBRL)))
ret = append(ret, cxml)
}
if ire.AccountsIXBRL != "" {
acxml := ElementWithNesting("Accounts", ElementWithNesting("Instance", ContentFromFile("InlineXBRLDocument", ire.AccountsIXBRL)))
ret = append(ret, acxml)
}
return []any{ElementWithNesting("XBRLsubmission", ret)}
}
CT600_SUBMIT_IXBRL:accounts/internal/ct600/govtalk/irenvelope.go
This now creates two parallel attachments, one for the computations (which has the tag Computation for some reason) and one for the accounts.And a little taffing later, that submits successfully (with the usual caveat that it flip-flops backwards and forwards between whether it does submit or not).
No comments:
Post a Comment