文件
mashangyoujiu/Application/Retail/Business/InventoryPrint.class.php

113 行
3.5 KiB
PHP
可执行文件

<?php
namespace Retail\Business;
use Common\Business\VerifyParam;
use Common\Model\InventoryPrintModel;
//[1.8.68]
/**
* 进销存打印样式类
* Class InventoryPrint
* [
* 打印单据样式设置查询 getStyleSet
* 打印单据样式设置 styleSet
* 打印单据样式设置的查询条件 styleSetTerm
* ]
* @package Retail\Business
*/
class InventoryPrint
{
/**
* 打印单据样式设置查询
* @param $param
* [
* user_type 3商户 4门店
* merchant_id
* store_id
* set_type 设置的类型 1采购单 2出售订单单据 3采购退货单 4盘点单 5报损单 6入库单 7退货单 8出库单 9入库单 10调拨出库后门店拒收单
* ]
* @return mixed
*/
public function getStyleSet($param)
{
$where = $this->styleSetTerm($param);
$InventoryPrintModel = new InventoryPrintModel();
$style_set = $InventoryPrintModel->getFindField($where, "style_set");
return callBack(statusCode()['success'], "查询成功", $style_set);
}
/**
* 打印单据样式设置
* @param $param
* [
* operator_type 操作端 1后台 2收银端 3助手端
* user_type 3商户 4门店
* merchant_id
* store_id
* style_set 样式设置
* set_type 设置的类型 1采购单 2出售订单单据 3采购退货单 4盘点单 5报损单 6入库单 7退货单 8出库单 9入库单 10调拨出库后门店拒收单
* ]
* @return mixed
*/
public function styleSet($param)
{
$verifyClass = new VerifyParam();
$verifyResult = $verifyClass->identityVerify($param);
if ($verifyResult['status'] != 1) {
return $verifyResult;
}
$where = $this->styleSetTerm($param);
$InventoryPrintModel = new InventoryPrintModel();
$id = $InventoryPrintModel->getFindField($where, "id");
$data = [
'style_set' => $param['style_set'],
];
if (empty($id)) {
$data['merchant_id'] = $param['merchant_id'];
$data['type'] = 1;
$data['set_type'] = $param['set_type'] ? $param['set_type'] : 1;
if ($param['user_type'] == 4) {
$data['store_id'] = $param['store_id'];
$data['type'] = 2;
}
$state = $InventoryPrintModel->addData($data);
} else {
$state = $InventoryPrintModel->updateData($where, $data);
}
if ($state['status'] == 1) {
return callBack(statusCode()['success'], "设置成功");
} else {
return callBack(statusCode()['error'], "暂无修改");
}
}
/**
* 打印单据样式设置的查询条件
* @param $param
* [
* user_type 3商户 4门店
* merchant_id
* store_id
* set_type 设置的类型 1采购单 2出售订单单据 3采购退货单 4盘点单 5报损单 6入库单 7退货单 8出库单 9入库单 10调拨出库后门店拒收单
* ]
* @return mixed
*/
public function styleSetTerm($param)
{
$where = [
'merchant_id' => $param['merchant_id'],
'type' => 1,
'set_type' => $param['set_type'] ? $param['set_type'] : 1
];
if ($param['user_type'] == 4) {
$where['store_id'] = $param['store_id'];
$where['type'] = 2;
}
return $where;
}
}