start working on VAT XMLs...
This commit is contained in:
parent
8580faefab
commit
9684daedb6
|
|
@ -13,6 +13,7 @@ import (
|
|||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"text/template"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
|
@ -36,6 +37,17 @@ type Balance struct {
|
|||
balance_end float64
|
||||
}
|
||||
|
||||
type Data struct {
|
||||
GenerationTime string
|
||||
ReportingPeriodFrom string
|
||||
ReportingPeriodTill string
|
||||
BusinessReferenceId string
|
||||
TotalConsideration string
|
||||
DataTaxRates map[string]string
|
||||
InputTaxInvestments string
|
||||
PayableTax string
|
||||
}
|
||||
|
||||
/* global variable declaration */
|
||||
var pdf *fpdf.Fpdf
|
||||
var yPos float64
|
||||
|
|
@ -475,6 +487,35 @@ func calculateProfit() float64 {
|
|||
|
||||
}
|
||||
|
||||
func outputMwst(whatquarter string) {
|
||||
fmt.Printf("Create Mwst Report for %s\n", whatquarter)
|
||||
|
||||
tm := time.Now()
|
||||
gmt_location := time.FixedZone("GMT", 0)
|
||||
|
||||
var data Data
|
||||
data.GenerationTime = fmt.Sprintf("%s", tm.In(gmt_location).Format("2006-01-02T15:04:05Z"))
|
||||
data.ReportingPeriodFrom = "2022-01-01"
|
||||
data.ReportingPeriodFrom = "2022-03-31"
|
||||
data.BusinessReferenceId = "ef1q2024_20220101_20220331_1"
|
||||
data.TotalConsideration = "43517.04"
|
||||
data.DataTaxRates = map[string]string{"7.70": "43517.04", "8.0": "Test only"}
|
||||
data.InputTaxInvestments = "174.09"
|
||||
data.PayableTax = "3176.72"
|
||||
|
||||
tmp, err := template.ParseFiles("vat_xml.tmpl")
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
err2 := tmp.Execute(os.Stdout, data)
|
||||
|
||||
if err2 != nil {
|
||||
log.Fatal(err2)
|
||||
}
|
||||
}
|
||||
|
||||
func usage() {
|
||||
fmt.Printf("usage: bookkeeper <action> <accounts file> <transactions file>\n")
|
||||
fmt.Printf("\n")
|
||||
|
|
@ -503,14 +544,9 @@ func main() {
|
|||
createBalanceSheet()
|
||||
case "journal":
|
||||
fmt.Println("Create Journal")
|
||||
case "mwst1":
|
||||
fmt.Println("Create Mwst1")
|
||||
case "mstw2":
|
||||
fmt.Println("Create Mwst2")
|
||||
case "mwst3":
|
||||
fmt.Println("Create Mwst3")
|
||||
case "mwst4":
|
||||
fmt.Println("Create Mwst4")
|
||||
case "mwst1", "mwst2", "mwst3", "mwst4":
|
||||
fmt.Println("Create Mwst Quarterly Report")
|
||||
outputMwst(action)
|
||||
case "new_year":
|
||||
fmt.Println("Create New Year")
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<eCH-0217:VATDeclaration xsi:schemaLocation="http://www.ech.ch/xmlns/eCH-0217/1 eCH-0217-1-0.xsd" xmlns:eCH-0217="http://www.ech.ch/xmlns/eCH-0217/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:eCH-0097="http://www.ech.ch/xmlns/eCH-0097/3" xmlns:eCH-0058="http://www.ech.ch/xmlns/eCH-0058/5">
|
||||
<eCH-0217:generalInformation>
|
||||
<eCH-0217:uid>
|
||||
<eCH-0097:uidOrganisationIdCategorie>CHE</eCH-0097:uidOrganisationIdCategorie>
|
||||
<eCH-0097:uidOrganisationId>105687350</eCH-0097:uidOrganisationId>
|
||||
</eCH-0217:uid>
|
||||
<eCH-0217:organisationName>nbit Informatik GmbH</eCH-0217:organisationName>
|
||||
<eCH-0217:generationTime>{{.GenerationTime}}</eCH-0217:generationTime>
|
||||
<eCH-0217:reportingPeriodFrom>{{.ReportingPeriodFrom}}</eCH-0217:reportingPeriodFrom>
|
||||
<eCH-0217:reportingPeriodTill>{{.ReportingPeriodTill}}</eCH-0217:reportingPeriodTill>
|
||||
<eCH-0217:typeOfSubmission>1</eCH-0217:typeOfSubmission>
|
||||
<eCH-0217:formOfReporting>1</eCH-0217:formOfReporting>
|
||||
<eCH-0217:businessReferenceId>{{.BusinessReferenceId}}</eCH-0217:businessReferenceId>
|
||||
<eCH-0217:sendingApplication>
|
||||
<eCH-0058:manufacturer>nbit Informatik GmbH</eCH-0058:manufacturer>
|
||||
<eCH-0058:product>bookkeeper</eCH-0058:product>
|
||||
<eCH-0058:productVersion>1.0</eCH-0058:productVersion>
|
||||
</eCH-0217:sendingApplication>
|
||||
</eCH-0217:generalInformation>
|
||||
<eCH-0217:turnoverComputation>
|
||||
<eCH-0217:totalConsideration>{{.TotalConsideration}}</eCH-0217:totalConsideration>
|
||||
<eCH-0217:suppliesToForeignCountries>0.00</eCH-0217:suppliesToForeignCountries>
|
||||
<eCH-0217:suppliesAbroad>0.00</eCH-0217:suppliesAbroad>
|
||||
<eCH-0217:transferNotificationProcedure>0.00</eCH-0217:transferNotificationProcedure>
|
||||
<eCH-0217:suppliesExemptFromTax>0.00</eCH-0217:suppliesExemptFromTax>
|
||||
<eCH-0217:reductionOfConsideration>0.00</eCH-0217:reductionOfConsideration>
|
||||
<eCH-0217:variousDeduction>
|
||||
<eCH-0217:amountVariousDeduction>0.00</eCH-0217:amountVariousDeduction>
|
||||
<eCH-0217:descriptionVariousDeduction/>
|
||||
</eCH-0217:variousDeduction>
|
||||
</eCH-0217:turnoverComputation>
|
||||
<eCH-0217:effectiveReportingMethod>
|
||||
<eCH-0217:grossOrNet>1</eCH-0217:grossOrNet>
|
||||
<eCH-0217:opted>0.00</eCH-0217:opted>
|
||||
{{ range $key, $value := .DataTaxRates -}}
|
||||
<eCH-0217:suppliesPerTaxRate>
|
||||
<eCH-0217:taxRate>{{ $key }}</eCH-0217:taxRate>
|
||||
<eCH-0217:turnover>{{ $value }}</eCH-0217:turnover>
|
||||
</eCH-0217:suppliesPerTaxRate>
|
||||
{{ end -}}
|
||||
<eCH-0217:inputTaxMaterialAndServices>0.00</eCH-0217:inputTaxMaterialAndServices>
|
||||
<eCH-0217:inputTaxInvestments>{{.InputTaxInvestments}}</eCH-0217:inputTaxInvestments>
|
||||
<eCH-0217:subsequentInputTaxDeduction>0.00</eCH-0217:subsequentInputTaxDeduction>
|
||||
<eCH-0217:inputTaxCorrections>0.00</eCH-0217:inputTaxCorrections>
|
||||
<eCH-0217:inputTaxReductions>0.00</eCH-0217:inputTaxReductions>
|
||||
</eCH-0217:effectiveReportingMethod>
|
||||
<eCH-0217:payableTax>{{.PayableTax}}</eCH-0217:payableTax>
|
||||
<eCH-0217:otherFlowsOfFunds>
|
||||
<eCH-0217:subsidies>0.00</eCH-0217:subsidies>
|
||||
<eCH-0217:donations>0.00</eCH-0217:donations>
|
||||
</eCH-0217:otherFlowsOfFunds>
|
||||
</eCH-0217:VATDeclaration>
|
||||
Loading…
Reference in New Issue