genrep

package module
v0.0.0-...-367357a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2016 License: MIT Imports: 7 Imported by: 1

README

genrep

GoDoc GoCard

genrep - golang report generator

Features

  • pdfact - Формирование акта выполненных работ в pdf по описанию в json

Roadmap

  • вебсервис
  • перенос описания pdf в шаблон text/template
  • плагины генерации в html/xls
  • плагины отчетов

Install

go get github.com/LeKovr/genrep
Download

See Latest release

License

The MIT License (MIT), see LICENSE.

Copyright (c) 2016 Alexey Kovrizhkin ak@elfire.ru

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAct

func GenerateAct(def Act, doc Document, customer Party, out string) (err error)

GenerateAct generates out file with act

Types

type Act

type Act struct {
	Contractor Party               `json:"contractor"`
	Customers  map[string]Party    `json:"customers"`
	Documents  map[string]Document `json:"documents"`
	Meta       struct {
		AuthorFmt  string `json:"AuthorFmt"`
		SubjectFmt string `json:"SubjectFmt"`
		TitleFmt   string `json:"TitleFmt"`
		Creator    string `json:"Creator"`
		Font       string `json:"Font"`
		Keywords   string `json:"Keywords"`
	} `json:"meta"`
	Names struct {
		Resume        string `json:"Resume"`
		Sign          string `json:"Sign"`
		Stamp         string `json:"Stamp"`
		TitleFmt      string `json:"TitleFmt"`
		TotalTax      string `json:"TotalTax"`
		TotalTitle    string `json:"TotalTitle"`
		TotalWordsFmt string `json:"TotalWordsFmt"`
		ZeroTax       string `json:"ZeroTax"`
	} `json:"names"`
	Services map[string]CustomerServices
}

Act - подготовленные для формирования документа атрибуты акта

type ActDef

type ActDef struct {
	ID          string  `json:"id"`
	Title       string  `json:"title"`
	Customer    string  `json:"customer"`
	Contractor  string  `json:"contractor"`
	Date        Date    `json:"date"`
	ConfirmDate Date    `json:"confirm"`
	Amount      float64 `json:"amount"`
	Tax         float64 `json:"tax"`
}

ActDef - атрибуты акта для сохранения в json

type CustomerServices

type CustomerServices map[string]ServiceDef

CustomerServices - описание услуги для каждого кода

type Date

type Date struct {
	time.Time
}

Date - тип для работы в json с датами вида 2006-01-02

func (Date) MarshalJSON

func (d Date) MarshalJSON() ([]byte, error)

MarshalJSON форматирует дату для экспорта в json

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON парсит дату из json

type Document

type Document struct {
	ID          string  `json:"id"`
	Customer    string  `json:"customer"`
	Date        Date    `json:"date"`
	Tax         float64 `json:"tax"`
	ConfirmDate Date    `json:"confirmed"`
	Services    []struct {
		Amount float64 `json:"Amount"`
		Code   string  `json:"Code"`
	} `json:"services"`
}

Document - атрибуты акта

type Party

type Party struct {
	ID       string `json:"Id"`
	Address  string `json:"Address"`
	Bank     string `json:"Bank"`
	Bik      string `json:"Bik"`
	Inn      string `json:"Inn"`
	Kpp      string `json:"Kpp"`
	Ks       string `json:"Ks"`
	Name     string `json:"Name"`
	NameFull string `json:"NameFull"`
	NameLong string `json:"NameLong"`
	Phone    string `json:"Phone"`
	Rs       string `json:"Rs"`
	Title    string `json:"Title"`
}

Party - сторона акта (заказчик или исполнитель)

type ServiceDef

type ServiceDef struct {
	Name  string  `json:"name"`  // наименование
	Units string  `json:"units"` // единица измерения
	Price float64 `json:"price"` // стоимость
}

ServiceDef - атрибуты оказываемых услуг

Directories

Path Synopsis
cmd
pdfact command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL