定制 mak8tech/zra-smart-invoice 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mak8tech/zra-smart-invoice

Composer 安装命令:

composer require mak8tech/zra-smart-invoice

包简介

Zambia Revenue Authority Smart Invoice Integration for Laravel 12 POS Systems

README 文档

README

Latest Version on Packagist Build Status PHP Version Laravel Version Total Downloads License

A Laravel 12 package for integrating with the Zambia Revenue Authority (ZRA) Smart Invoice system for POS applications.

Features

  • Easy integration with Laravel 12 applications
  • Seamless Inertia.js React/TypeScript components
  • Device initialization with ZRA API
  • Sales, purchase, and stock data submission
  • Transaction logging and monitoring
  • Configuration management
  • Status indicators and analytics
  • Support for various invoice types (NORMAL, COPY, TRAINING, PROFORMA) and transaction types
  • Comprehensive tax handling with support for multiple tax categories
  • Report generation (X and Z Reports)
  • Inventory management with stock tracking and validation

What's New in 1.0.1

  • Support for Various Invoice Types: Added configuration options for different invoice and transaction types
  • Comprehensive Tax Handling: Support for multiple tax categories, zero-rated and exempt transactions
  • Report Generation: X and Z reports for auditing and compliance purposes
  • Inventory Management: Complete inventory tracking system with stock validation during sales

Installation

You can install the package via composer:

composer require mak8tech/zra-smart-invoice

Publishing Assets

Publish the package configuration and migrations:

php artisan vendor:publish --provider="Mak8Tech\ZraSmartInvoice\ZraServiceProvider"

Configuration

After publishing the package assets, you can configure the ZRA integration in the config/zra.php file.

You can also set these in your .env file:

ZRA_BASE_URL=https://api-sandbox.zra.org.zm/vsdc-api/v1
ZRA_TPIN=
ZRA_BRANCH_ID=
ZRA_DEVICE_SERIAL=
ZRA_DEBUG=false

Usage

Initialization

Initialize your device with ZRA:

use Mak8Tech\ZraSmartInvoice\Facades\Zra;

// Initialize device
$result = Zra::initializeDevice('1234567890', '001', 'DEVICE123456');

Sending Sales Data

use Mak8Tech\ZraSmartInvoice\Facades\Zra;

// Prepare sales data
$salesData = [
    'invoiceNumber' => 'INV-1234',
    'timestamp' => now()->format('Y-m-d H:i:s'),
    'invoiceType' => 'NORMAL', // Can also be COPY, TRAINING, PROFORMA
    'transactionType' => 'SALE', // Can also be CREDIT_NOTE, DEBIT_NOTE, ADJUSTMENT, REFUND
    'items' => [
        [
            'name' => 'Product 1',
            'quantity' => 2,
            'unitPrice' => 100.00,
            'totalAmount' => 200.00,
            'taxRate' => 16,
            'taxAmount' => 32.00,
            'taxCategory' => 'VAT', // Can also be TOURISM_LEVY, EXCISE_DUTY, etc.
        ],
    ],
    'totalAmount' => 200.00,
    'totalTax' => 32.00,
    'paymentType' => 'CASH',
    'customerTpin' => '',  // Optional for customer without TPIN
];

// Send to ZRA
$result = Zra::sendSalesData($salesData);

Generating Reports

use Mak8Tech\ZraSmartInvoice\Facades\Zra;

// Generate X report (interim report)
$xReport = Zra::generateXReport();

// Generate Z report (end of day report)
$zReport = Zra::generateZReport();

// Get daily summary report
$dailyReport = Zra::getDailyReport('2025-04-11');

Managing Inventory

use Mak8Tech\ZraSmartInvoice\Facades\Zra;

// Add new product to inventory
$product = Zra::addInventoryProduct([
    'code' => 'PROD001',
    'name' => 'Product Name',
    'description' => 'Product Description',
    'unitPrice' => 100.00,
    'taxRate' => 16,
    'taxCategory' => 'VAT',
    'initialStock' => 50
]);

// Update stock quantity
Zra::updateStockQuantity('PROD001', 60, 'STOCK_ADJUSTMENT', 'Inventory count adjustment');

// Check if product has sufficient stock
$hasStock = Zra::checkProductStock('PROD001', 5); // Returns true if at least 5 units available

Web Interface

The package includes a web interface accessible at /zra (configurable) where you can:

  • Initialize your device
  • View device status
  • Test connectivity
  • View transaction logs
  • Generate X and Z reports
  • Manage inventory and stock levels

Testing

composer test

Deployment to Packagist

For full instructions on deploying this package to Packagist.org, please see the Deployment Guide.

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.

mak8tech/zra-smart-invoice 适用场景与选型建议

mak8tech/zra-smart-invoice 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 3, 最近一次更新时间为 2025 年 03 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 mak8tech/zra-smart-invoice 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 mak8tech/zra-smart-invoice 我们能提供哪些服务?
定制开发 / 二次开发

基于 mak8tech/zra-smart-invoice 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 21
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-22