pajkho/siephp

用于导出到瑞典SIE格式的库。目前只支持规范的一部分,例如导出到SIE4(验证/交易数据)。

维护者

详细信息

github.com/pajkho/siephp

源代码

1.0.2 2022-10-12 18:43 UTC

This package is not auto-updated.

Last update: 2024-09-26 03:28:45 UTC


README

关于

SIEPHP是一个库,它允许将账务数据导出到瑞典SIE格式。有关SIE的更多信息,请参阅http://www.sie.se/

目前只支持规范的一部分,例如导出到SIE4(验证/交易数据)。未来还可以编写SIE的加载类,并支持SIE标准的更多功能。

它基于简单的数据类,这些类代表SIE标准中的公司/验证/交易模型。它还附带一个可以将数据导出到SIE格式的dumper类。

安装

使用以下命令安装最新版本:

$ composer require pajkho/siephp

用法

examples/ 包含一些使用SIE-PHP的示例。这是 examples/simple.php

// create a company
$company = (new SIE\Data\Company())
    // set company name
    ->setCompanyName('My company')
    // add a verification series
    ->addVerificationSeries(new SIE\Data\VerificationSeries())
    // add two accounts
    ->addAccount((new SIE\Data\Account(1511))->setName('Kundfordringar'))
    ->addAccount((new SIE\Data\Account(3741))->setName('Öresutjämning'))
;

// add a verification with two transactions
$verification = (new SIE\Data\Verification(591000490))->setDate('20150105')
    ->addTransaction(
        (new SIE\Data\Transaction())
            ->setAccount($company->getAccount(1511))
            ->setAmount(-0.24)
    )
    ->addTransaction(
        (new SIE\Data\Transaction())
            ->setAccount($company->getAccount(3741))
            ->setAmount(0.24)
    )
;
// add the verification to the company
$company->getVerificationSeriesAll()[0]->addVerification($verification);
// validate data, will throw Exception if invalid data
$company->validate();

$dumper = new SIE\Dumper\SIEDumper();
$output = $dumper->dump($company);
echo $output;

它将生成以下输出(在PC8/CP437编码中)

#FLAGGA 0
#FORMAT PC8
#SIETYP 4
#PROGRAM "SIE-PHP exporter"
#GEN 20150921
#FNAMN "My company"
#KONTO 1511 Kundfordringar
#KONTO 3741 Öresutjämning

#VER A 591000490 20150105
{
    #TRANS 1511 {} -0.24 20150105
    #TRANS 3741 {} 0.24 20150105
}

有关自定义TSV到SIE转换器的更多信息,请参阅examples/TSVtoSIE.php,该转换器从TSV文件加载相同的数据。

作者

Johan Wilfer - johan [at] jttech.se - http://jttech.se

许可证

SIE-PHP在MIT许可证下发布 - 请参阅LICENSE文件以获取详细信息

感谢

Mitronic AB (http://mitronic.se) 为这项工作提供资金。

有问题?

请将电子邮件发送至 johan [at] jttech.se