usesgraphcrt/yii2-check-print-module

点验机打印模块及工作交接模块

dev-master 2017-05-03 12:30 UTC

This package is not auto-updated.

Last update: 2024-09-27 23:55:49 UTC


README

点验机打印模块及工作交接模块

本模块旨在基于“АТОЛ”驱动程序进行点验机操作;

连接和设置

执行以下命令

php composer.phar require --prefer-dist usesgraphcrt/yii2-check-print-module "*"

或者将以下内容添加到 composer.json 文件的 require 部分

"usesgraphcrt/yii2-check-print-module": "*"

要开始使用该模块,请将其添加到配置文件中的模块部分

'modules' => [
        ...
        'checkprint' => [
            'class' => \usesgraphcrt\checkPrint\Module::className(),
            'orderModel' => 'namespace модели заказов',
            'orderElementModel' => 'namespace модели элементов заказа',
            'adminRoles' => [//роли, которые имеют доступ к печати],
            'organizationInn' => 'some Inn', //ИНН организации (используется для печати на чеке)
            'organizationAddress' => 'address', //так же используется для печати на чеке
            'examCheckSite' => 'siteUrl', //адрес сайта, на котором можно проверить достоверность чека
        ],
    ],

为了使打印功能正常工作,需要将模块的 AssetBundle 在您的布局中注册,添加以下行

usesgraphcrt\checkprint\PrintAsset::register($this);

AssetBundle

event-handler.js 监听两个事件:successOrderCreate - 在成功创建订单后打印小票。为了正确工作,需要为该事件创建一个触发器。

$(document).on('successOrderCreate', function() {
        ...
});

为了处理点验机的交接(开启/关闭),使用具有 data-role=main-session 的元素的点击事件,而开启/关闭的实现是通过 worksess-stop / worksess-start 类实现的。

$(document).on('click','[data-role=main-session]', function() {
    var self = $(this),
        host = window.location.hostname;
    if (self.hasClass('worksess-stop')) {
        ...
    } else {
       ...
    }
});