创建版本
This commit is contained in:
@@ -0,0 +1,220 @@
|
||||
<?php namespace Gdoo\Stock\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
use Gdoo\User\Models\User;
|
||||
use Gdoo\Stock\Models\Allocation;
|
||||
|
||||
use Gdoo\Model\Grid;
|
||||
use Gdoo\Model\Form;
|
||||
|
||||
use Gdoo\Stock\Services\StockService;
|
||||
|
||||
use Gdoo\Index\Controllers\WorkflowController;
|
||||
|
||||
class AllocationController extends WorkflowController
|
||||
{
|
||||
public $permission = ['dialog', 'logistics', 'stockSelect'];
|
||||
|
||||
// 列表
|
||||
public function indexAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'stock_allocation',
|
||||
'referer' => 1,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '显示',
|
||||
'action' => 'show',
|
||||
'display' => $this->access['show'],
|
||||
]];
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->orderBy($header['sort'], $header['order']);
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
//['name' => '删除', 'icon' => 'fa-remove', 'action' => 'delete', 'display' => $this->access['delete']],
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = Allocation::$tabs;
|
||||
$header['bys'] = Allocation::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 新建
|
||||
public function createAction($action = 'edit')
|
||||
{
|
||||
$id = (int) Request::get('id');
|
||||
$header['action'] = $action;
|
||||
$header['code'] = 'stock_allocation';
|
||||
$header['id'] = $id;
|
||||
|
||||
$form = Form::make($header);
|
||||
$tpl = $action == 'print' ? 'print' : 'create';
|
||||
return $this->display([
|
||||
'form' => $form,
|
||||
], $tpl);
|
||||
}
|
||||
|
||||
// 编辑
|
||||
public function editAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
// 审核
|
||||
public function auditAction()
|
||||
{
|
||||
return $this->createAction('audit');
|
||||
}
|
||||
|
||||
// 显示
|
||||
public function showAction()
|
||||
{
|
||||
return $this->createAction('show');
|
||||
}
|
||||
|
||||
// 打印
|
||||
public function printAction()
|
||||
{
|
||||
$id = Request::get('id');
|
||||
$template_id = Request::get('template_id');
|
||||
|
||||
$this->layout = 'layouts.print3';
|
||||
$master = DB::table('stock_allocation as m')
|
||||
->where('m.id', $id)
|
||||
->leftJoin('warehouse as wo', 'wo.id', '=', 'm.out_warehouse_id')
|
||||
->leftJoin('warehouse as wi', 'wi.id', '=', 'm.in_warehouse_id')
|
||||
->selectRaw('m.*, wi.name as in_warehouse_name, wo.name as out_warehouse_name, wi.code as in_warehouse_code, wo.code as out_warehouse_code')
|
||||
->first();
|
||||
|
||||
$rows = DB::table('stock_allocation_data as d')
|
||||
->leftJoin('stock_allocation as m', 'm.id', '=', 'd.allocation_id')
|
||||
->leftJoin('product as p', 'p.id', '=', 'd.product_id')
|
||||
->leftJoin('product_unit as pu', 'pu.id', '=', 'p.unit_id')
|
||||
->where('m.id', $id)
|
||||
->selectRaw('
|
||||
d.*,
|
||||
p.name as product_name,
|
||||
p.code as product_code,
|
||||
p.spec as product_spec,
|
||||
pu.name as product_unit
|
||||
')
|
||||
->orderBy('p.code', 'asc')
|
||||
->get();
|
||||
|
||||
$form = [
|
||||
'template' => DB::table('model_template')->where('id', $template_id)->first()
|
||||
];
|
||||
|
||||
if ($master['in_warehouse_code'] == 27 || $master['in_warehouse_code'] == 21) {
|
||||
$warehouse_by = '李志全';
|
||||
} else {
|
||||
$warehouse_by = '万海英';
|
||||
}
|
||||
|
||||
$tpl = $this->display([
|
||||
'master' => $master,
|
||||
'rows' => $rows,
|
||||
'form' => $form,
|
||||
'warehouse_by' => $warehouse_by,
|
||||
], 'print/'.$template_id);
|
||||
return $tpl;
|
||||
}
|
||||
|
||||
// 选择库存
|
||||
public function stockSelectAction()
|
||||
{
|
||||
$search = search_form(['advanced' => ''], [
|
||||
['form_type' => 'text', 'name' => '产品名称', 'field' => 'name'],
|
||||
['form_type' => 'text', 'name' => '产品编码', 'field' => 'code']
|
||||
], 'model');
|
||||
$query = $search['query'];
|
||||
if (Request::method() == 'POST') {
|
||||
$fields = [];
|
||||
foreach($search['forms']['field'] as $i => $field) {
|
||||
$fields[$field] = $search['forms']['search'][$i];
|
||||
}
|
||||
if($fields['name']) {
|
||||
$query['value'] = $fields['name'];
|
||||
}
|
||||
if($fields['code']) {
|
||||
$query['value'] = $fields['code'];
|
||||
}
|
||||
|
||||
$rows = StockService::getBatchSelectZY($query['warehouse_id'], '', $query['value']);
|
||||
return ['data' => $rows];
|
||||
}
|
||||
return $this->render([
|
||||
'search' => $search,
|
||||
]);
|
||||
}
|
||||
|
||||
// 物流信息
|
||||
public function logisticsAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$gets = Request::get('stock_allocation');
|
||||
$id = $gets['id'];
|
||||
$gets['freight_created_dt'] = date('Y-m-d H:i:s');
|
||||
$gets['freight_created_by'] = auth()->user()->name;
|
||||
DB::table('stock_allocation')->where('id', $id)->update($gets);
|
||||
return $this->json('物流信息提交成功。', true);
|
||||
}
|
||||
$file = base_path().'/addons/'.ucfirst(Request::module()).'/views/'.Request::controller().'/'.Request::action().'.html';
|
||||
$id = Request::get('id');
|
||||
$row = Allocation::find($id);
|
||||
$freight_quantity = floatval($row['freight_quantity']);
|
||||
|
||||
if ($freight_quantity == 0) {
|
||||
$count = DB::table('stock_allocation_data')
|
||||
->where('allocation_id', $id)->selectRaw('sum(total_weight) as weight, sum(quantity) as quantity')->first();
|
||||
$weight = number_format($count['weight'] / 1000, 2);
|
||||
$quantity = number_format($count['quantity'], 2);
|
||||
$row['freight_quantity'] = $quantity;
|
||||
$row['freight_weight'] = $weight;
|
||||
}
|
||||
$form = Form::make1(['table' => 'stock_allocation', 'file' => $file, 'row' => $row]);
|
||||
return $form;
|
||||
}
|
||||
|
||||
// 删除
|
||||
public function deleteAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = Request::get('id');
|
||||
return Form::remove(['code' => 'stock_allocation', 'ids' => $ids]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
<?php namespace Gdoo\Stock\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
use Gdoo\User\Models\User;
|
||||
use Gdoo\Stock\Models\Cancel;
|
||||
|
||||
use Gdoo\Model\Grid;
|
||||
use Gdoo\Model\Form;
|
||||
|
||||
use Gdoo\Index\Controllers\WorkflowController;
|
||||
|
||||
class CancelController extends WorkflowController
|
||||
{
|
||||
public $permission = ['dialog'];
|
||||
|
||||
// 列表
|
||||
public function indexAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'stock_cancel',
|
||||
'referer' => 1,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '显示',
|
||||
'action' => 'show',
|
||||
'display' => $this->access['show'],
|
||||
]];
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->orderBy($header['sort'], $header['order']);
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
//['name' => '删除', 'icon' => 'fa-remove', 'action' => 'delete', 'display' => $this->access['delete']],
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
|
||||
$header['left_buttons'] = [
|
||||
['name' => '批量编辑', 'color' => 'default', 'icon' => 'fa-pencil-square-o', 'action' => 'batchEdit', 'display' => $this->access['batchEdit']],
|
||||
];
|
||||
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = Cancel::$tabs;
|
||||
$header['bys'] = Cancel::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 新建
|
||||
public function createAction($action = 'edit')
|
||||
{
|
||||
$id = (int) Request::get('id');
|
||||
$header['action'] = $action;
|
||||
$header['code'] = 'stock_cancel';
|
||||
$header['id'] = $id;
|
||||
|
||||
$form = Form::make($header);
|
||||
$tpl = $action == 'print' ? 'print' : 'create';
|
||||
return $this->display([
|
||||
'form' => $form,
|
||||
], $tpl);
|
||||
}
|
||||
|
||||
// 编辑
|
||||
public function editAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
// 审核
|
||||
public function auditAction()
|
||||
{
|
||||
return $this->createAction('audit');
|
||||
}
|
||||
|
||||
// 显示
|
||||
public function showAction()
|
||||
{
|
||||
return $this->createAction('show');
|
||||
}
|
||||
|
||||
// 打印
|
||||
public function printAction()
|
||||
{
|
||||
$id = Request::get('id');
|
||||
$template_id = Request::get('template_id');
|
||||
|
||||
$this->layout = 'layouts.print3';
|
||||
$master = DB::table('stock_cancel as sd')
|
||||
->leftJoin('customer as c', 'c.id', '=', 'sd.customer_id')
|
||||
->leftJoin('customer_tax as ct', 'ct.id', '=', 'sd.tax_id')
|
||||
->leftJoin('sale_type as st', 'st.id', '=', 'sd.type_id')
|
||||
->selectRaw('sd.*, ct.name as tax_name, c.name as customer_name, st.name as type_name')
|
||||
->where('sd.id', $id)
|
||||
->first();
|
||||
|
||||
$model = DB::table('stock_cancel_data as sdd')
|
||||
->leftJoin('stock_cancel as sd', 'sd.id', '=', 'sdd.cancel_id')
|
||||
->leftJoin('product as p', 'p.id', '=', 'sdd.product_id')
|
||||
->leftJoin('product_unit as pu', 'pu.id', '=', 'p.unit_id')
|
||||
->leftJoin('customer_order_type as cot', 'cot.id', '=', 'sdd.type_id')
|
||||
->leftJoin('warehouse as w', 'w.id', '=', 'sdd.warehouse_id')
|
||||
->where('sdd.cancel_id', $id);
|
||||
|
||||
$rows = $model->selectRaw("
|
||||
sdd.*,
|
||||
p.name as product_name,
|
||||
p.spec as product_spec,
|
||||
cot.name as type_name,
|
||||
pu.name as product_unit,
|
||||
p.material_type,
|
||||
p.product_type
|
||||
")
|
||||
->orderBy('p.code', 'asc')
|
||||
->get();
|
||||
|
||||
$form = [
|
||||
'template' => DB::table('model_template')->where('id', $template_id)->first()
|
||||
];
|
||||
|
||||
return $this->display([
|
||||
'master' => $master,
|
||||
'rows' => $rows,
|
||||
'form' => $form,
|
||||
], 'print/'.$template_id);
|
||||
}
|
||||
|
||||
// 批量编辑
|
||||
public function batchEditAction()
|
||||
{
|
||||
$gets = Request::all();
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = explode(',', $gets['ids']);
|
||||
DB::table('stock_cancel')->whereIn('id', $ids)->update([
|
||||
$gets['field'] => $gets['search_0'],
|
||||
]);
|
||||
return $this->json('修改完成。', true);
|
||||
}
|
||||
$header = Grid::batchEdit([
|
||||
'code' => 'stock_cancel',
|
||||
'columns' => ['customer_id', 'tax_id'],
|
||||
]);
|
||||
return view('batchEdit', [
|
||||
'gets' => $gets,
|
||||
'header' => $header
|
||||
]);
|
||||
}
|
||||
|
||||
// 删除
|
||||
public function deleteAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = Request::get('id');
|
||||
return Form::remove(['code' => 'stock_cancel', 'ids' => $ids]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php namespace Gdoo\Stock\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
use Gdoo\Model\Grid;
|
||||
use Gdoo\Model\Form;
|
||||
|
||||
use Gdoo\Stock\Models\StockCategory;
|
||||
|
||||
use Gdoo\Index\Controllers\DefaultController;
|
||||
|
||||
class CategoryController extends DefaultController
|
||||
{
|
||||
public $permission = ['dialog'];
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'stock_type',
|
||||
'referer' => 1,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '编辑',
|
||||
'action' => 'edit',
|
||||
'display' => $this->access['edit'],
|
||||
]];
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->orderBy($header['sort'], $header['order'])
|
||||
->orderBy('id', 'desc');
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
['name' => '删除', 'icon' => 'fa-remove', 'action' => 'delete', 'display' => $this->access['delete']],
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = StockCategory::$tabs;
|
||||
$header['bys'] = StockCategory::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 新建客户联系人
|
||||
public function createAction()
|
||||
{
|
||||
$id = (int)Request::get('id');
|
||||
$form = Form::make(['code' => 'stock_type', 'id' => $id]);
|
||||
return $this->render([
|
||||
'form' => $form,
|
||||
], 'create');
|
||||
}
|
||||
|
||||
// 创建客户联系人
|
||||
public function editAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹出层信息
|
||||
*/
|
||||
public function dialogAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'stock_type',
|
||||
]);
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table']);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->where('stock_type.status', 1)
|
||||
->orderBy('stock_type.sort', 'asc');
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
|
||||
$rows = $model->paginate($query['limit']);
|
||||
$items = Grid::dataFilters($rows, $header, function($item) {
|
||||
return $item;
|
||||
});
|
||||
return response()->json($items);
|
||||
}
|
||||
|
||||
return $this->render([
|
||||
'search' => $search,
|
||||
], 'dialog');
|
||||
}
|
||||
|
||||
// 删除
|
||||
public function deleteAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = Request::get('id');
|
||||
return Form::remove(['code' => 'stock_type', 'ids' => $ids]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,470 @@
|
||||
<?php namespace Gdoo\Stock\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
use App\Support\AES;
|
||||
|
||||
use Gdoo\Stock\Models\Delivery;
|
||||
|
||||
use Gdoo\Model\Grid;
|
||||
use Gdoo\Model\Form;
|
||||
|
||||
use Gdoo\Model\Models\Bill;
|
||||
use Gdoo\Model\Models\Step;
|
||||
use Gdoo\Model\Models\Run;
|
||||
|
||||
use Gdoo\Model\Services\ModelService;
|
||||
use Gdoo\Model\Services\StepService;
|
||||
use Gdoo\Stock\Services\StockService;
|
||||
|
||||
use Gdoo\Index\Controllers\WorkflowController;
|
||||
|
||||
class DeliveryController extends WorkflowController
|
||||
{
|
||||
public $permission = [
|
||||
'dialog',
|
||||
'logistics',
|
||||
'getBatchSelect',
|
||||
'getBatchSelectAll',
|
||||
'getBatchSelectZY',
|
||||
'autoSave'
|
||||
];
|
||||
|
||||
// 发货列表
|
||||
public function indexAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'stock_delivery',
|
||||
'referer' => 1,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '显示',
|
||||
'action' => 'show',
|
||||
'display' => $this->access['show'],
|
||||
]];
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->orderBy($header['sort'], $header['order']);
|
||||
|
||||
// 过滤库管角色 辅料:30, 成品:31
|
||||
if (auth()->user()->role_id == 30) {
|
||||
$model->where('stock_delivery.type_id', 2);
|
||||
}
|
||||
if (auth()->user()->role_id == 31) {
|
||||
$model->where('stock_delivery.type_id', '<>', 2);
|
||||
}
|
||||
|
||||
// 发货统计
|
||||
$model->leftJoin(DB::raw('(select SUM(ISNULL(d.quantity, 0)) total_quantity, d.delivery_id
|
||||
FROM stock_delivery_data as d
|
||||
GROUP BY d.delivery_id
|
||||
) sdd
|
||||
'), 'stock_delivery.id', '=', 'sdd.delivery_id');
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
// 客户权限
|
||||
$region = regionCustomer('customer_id_customer');
|
||||
if ($region['authorise']) {
|
||||
foreach ($region['whereIn'] as $key => $where) {
|
||||
$model->whereIn($key, $where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$model->addSelect(DB::raw('sdd.total_quantity'));
|
||||
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
|
||||
$header['left_buttons'] = [
|
||||
['name' => '批量编辑', 'color' => 'default', 'icon' => 'fa-pencil-square-o', 'action' => 'batchEdit', 'display' => $this->access['batchEdit']],
|
||||
];
|
||||
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = Delivery::$tabs;
|
||||
$header['bys'] = Delivery::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 明细列表
|
||||
public function detailAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'stock_delivery',
|
||||
'referer' => 1,
|
||||
'template_id' => 71,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '显示',
|
||||
'action' => 'show',
|
||||
'display' => $this->access['show'],
|
||||
]];
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->orderBy($header['sort'], $header['order']);
|
||||
|
||||
// 过滤库管角色 辅料:30, 成品:31
|
||||
if (auth()->user()->role_id == 30) {
|
||||
$model->where('stock_delivery.type_id', 2);
|
||||
}
|
||||
if (auth()->user()->role_id == 31) {
|
||||
$model->where('stock_delivery.type_id', '<>', 2);
|
||||
}
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
// 客户权限
|
||||
$region = regionCustomer('customer_id_customer');
|
||||
if ($region['authorise']) {
|
||||
foreach ($region['whereIn'] as $key => $where) {
|
||||
$model->whereIn($key, $where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = Delivery::$tabs2;
|
||||
$header['bys'] = Delivery::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 自动保存
|
||||
public function autoSaveAction()
|
||||
{
|
||||
$gets = Request::all();
|
||||
$master = $gets['master'];
|
||||
$keys = AES::decrypt($master['key'], config('app.key'));
|
||||
list($bill_id, $id) = explode('.', $keys);
|
||||
$bill = Bill::find($bill_id);
|
||||
|
||||
// 发货日期为空
|
||||
if (empty($gets['stock_delivery']['invoice_dt'])) {
|
||||
$gets['stock_delivery']['invoice_dt'] = date('Y-m-d');
|
||||
}
|
||||
|
||||
$models = ModelService::getModels($bill->model_id);
|
||||
if (Request::method() == 'POST') {
|
||||
$rows = $gets['stock_delivery_data']['rows'];
|
||||
$product_ids = [];
|
||||
foreach($rows as $row) {
|
||||
$product_ids[$row['product_id']] = $row['product_id'];
|
||||
}
|
||||
|
||||
// 获取产品列表
|
||||
$vars2 = DB::table('product')->whereIn('id', $product_ids)->get()->keyBy('id');
|
||||
$materiels = $products = [];
|
||||
foreach($rows as $row) {
|
||||
$product = $vars2[$row['product_id']];
|
||||
if ($product['material_type'] > 0) {
|
||||
$materiels[] = $row;
|
||||
} else {
|
||||
$products[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$print_ids = [];
|
||||
if (count($products) > 0) {
|
||||
$gets['stock_delivery']['type_id'] = 1;
|
||||
$gets['stock_delivery_data']['rows'] = $products;
|
||||
$id = Form::store($bill, $models, $gets, 0);
|
||||
$print_ids[] = $id;
|
||||
}
|
||||
|
||||
if (count($materiels) > 0) {
|
||||
$gets['stock_delivery']['type_id'] = 2;
|
||||
$gets['stock_delivery_data']['rows'] = $materiels;
|
||||
$id = Form::store($bill, $models, $gets, 0);
|
||||
$print_ids[] = $id;
|
||||
}
|
||||
|
||||
foreach($print_ids as $print_id) {
|
||||
DB::table('stock_delivery')->where('id', $print_id)->update(['print_master_id' => $print_ids[0]]);
|
||||
}
|
||||
|
||||
// 自动保存发货单返回数据
|
||||
$url = url($master['uri'].'/show', ['id' => $id, 'client' => $master['client']]);
|
||||
return $this->json($bill['name'].'保存成功', $url);
|
||||
}
|
||||
return $this->createAction('audit');
|
||||
}
|
||||
|
||||
// 新建
|
||||
public function createAction($action = 'edit')
|
||||
{
|
||||
$id = (int) Request::get('id');
|
||||
$header['action'] = $action;
|
||||
$header['code'] = 'stock_delivery';
|
||||
$header['id'] = $id;
|
||||
|
||||
// 客户权限
|
||||
$header['region'] = ['field' => 'customer_id'];
|
||||
$header['authorise'] = ['action' => 'index', 'field' => 'created_id'];
|
||||
|
||||
$header['select'] = '
|
||||
product_id_product.weight,
|
||||
product_id_product.weight * stock_delivery_data.quantity as total_weight
|
||||
';
|
||||
|
||||
$form = Form::make($header);
|
||||
$tpl = $action == 'print' ? 'print' : 'create';
|
||||
return $this->display([
|
||||
'form' => $form,
|
||||
], $tpl);
|
||||
}
|
||||
|
||||
// 编辑
|
||||
public function editAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
// 审核
|
||||
public function auditAction()
|
||||
{
|
||||
return $this->createAction('audit');
|
||||
}
|
||||
|
||||
// 显示
|
||||
public function showAction()
|
||||
{
|
||||
return $this->createAction('show');
|
||||
}
|
||||
|
||||
// 批量编辑
|
||||
public function batchEditAction()
|
||||
{
|
||||
$gets = Request::all();
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = explode(',', $gets['ids']);
|
||||
DB::table('stock_delivery')->whereIn('id', $ids)->update([
|
||||
$gets['field'] => $gets['search_0'],
|
||||
]);
|
||||
return $this->json('修改完成。', true);
|
||||
}
|
||||
$header = Grid::batchEdit([
|
||||
'code' => 'stock_delivery',
|
||||
'columns' => ['customer_id', 'tax_id'],
|
||||
]);
|
||||
return view('batchEdit', [
|
||||
'gets' => $gets,
|
||||
'header' => $header
|
||||
]);
|
||||
}
|
||||
|
||||
// 打印
|
||||
public function printAction()
|
||||
{
|
||||
$id = Request::get('id');
|
||||
$template_id = Request::get('template_id');
|
||||
|
||||
$master = DB::table('stock_delivery as sd')
|
||||
->leftJoin('customer as c', 'c.id', '=', 'sd.customer_id')
|
||||
->leftJoin('customer_tax as ct', 'ct.id', '=', 'sd.tax_id')
|
||||
->leftJoin('sale_type as st', 'st.id', '=', 'sd.type_id')
|
||||
->selectRaw('sd.*, ct.name as tax_name, c.name as customer_name, st.name as type_name')
|
||||
->where('sd.id', $id)
|
||||
->first();
|
||||
|
||||
$model = DB::table('stock_delivery_data as sdd')
|
||||
->leftJoin('stock_delivery as sd', 'sd.id', '=', 'sdd.delivery_id')
|
||||
->leftJoin('product as p', 'p.id', '=', 'sdd.product_id')
|
||||
->leftJoin('product_unit as pu', 'pu.id', '=', 'p.unit_id')
|
||||
->leftJoin('customer_order_type as cot', 'cot.id', '=', 'sdd.type_id')
|
||||
->leftJoin('warehouse as w', 'w.id', '=', 'sdd.warehouse_id');
|
||||
|
||||
if ($template_id == 112) {
|
||||
$model->where('sd.print_master_id', $master['print_master_id']);
|
||||
} else {
|
||||
$model->where('sdd.delivery_id', $id);
|
||||
}
|
||||
|
||||
$model->whereRaw("p.code <> '99001'");
|
||||
|
||||
$rows = $model->selectRaw("
|
||||
sdd.*,
|
||||
p.name as product_name,
|
||||
p.spec as product_spec,
|
||||
cot.name as type_name,
|
||||
pu.name as product_unit,
|
||||
p.material_type,
|
||||
p.product_type,
|
||||
SUBSTRING(batch_sn, 3, 4) as batch_sn,
|
||||
case when right(w.name, 4) = '不满件库' then 'B' else '' end warehouse_type
|
||||
")
|
||||
->orderBy('p.code', 'asc')
|
||||
->get();
|
||||
|
||||
$money = DB::table('stock_delivery_data as sdd')
|
||||
->leftJoin('product as p', 'p.id', '=', 'sdd.product_id')
|
||||
->where('sdd.delivery_id', $id)
|
||||
->whereRaw("p.code = '99001'")
|
||||
->sum("money");
|
||||
|
||||
$form = [
|
||||
'template' => DB::table('model_template')->where('id', $template_id)->first()
|
||||
];
|
||||
|
||||
if ($template_id == 87) {
|
||||
$this->layout = 'layouts.print_stiReport';
|
||||
return $this->display([
|
||||
'master' => $master,
|
||||
'money' => $money,
|
||||
'rows' => $rows,
|
||||
'form' => $form,
|
||||
], 'print/'.$template_id);
|
||||
} else {
|
||||
$this->layout = 'layouts.print2';
|
||||
print_prince($this->display([
|
||||
'master' => $master,
|
||||
'money' => $money,
|
||||
'rows' => $rows,
|
||||
'form' => $form,
|
||||
], 'print/'.$template_id));
|
||||
}
|
||||
}
|
||||
|
||||
// 物流信息
|
||||
public function logisticsAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$gets = Request::get('stock_delivery');
|
||||
$id = $gets['id'];
|
||||
$gets['freight_created_dt'] = date('Y-m-d H:i:s');
|
||||
$gets['freight_created_by'] = auth()->user()->name;
|
||||
DB::table('stock_delivery')->where('id', $id)->update($gets);
|
||||
return $this->json('物流信息提交成功。', true);
|
||||
}
|
||||
$file = base_path().'/addons/'.ucfirst(Request::module()).'/views/'.Request::controller().'/'.Request::action().'.xml';
|
||||
$id = Request::get('id');
|
||||
$row = Delivery::find($id);
|
||||
$freight_quantity = floatval($row['freight_quantity']);
|
||||
|
||||
if ($freight_quantity == 0) {
|
||||
$count = DB::table('stock_delivery_data')
|
||||
->where('delivery_id', $id)->selectRaw('sum(total_weight) as weight, sum(quantity) as quantity')->first();
|
||||
$weight = intval($count['weight'] / 100);
|
||||
$weight = number_format($weight / 10, 1);
|
||||
$quantity = $count['quantity'];
|
||||
$row['freight_quantity'] = $quantity;
|
||||
$row['freight_weight'] = $weight;
|
||||
}
|
||||
$form = Form::make1(['table' => 'stock_delivery', 'file' => $file, 'row' => $row]);
|
||||
return $form;
|
||||
}
|
||||
|
||||
// 获取库存(不含不满件)
|
||||
public function getBatchSelectAction()
|
||||
{
|
||||
$search = search_form(['advanced' => ''], [
|
||||
['form_type' => 'text', 'name' => '产品名称', 'field' => 'name'],
|
||||
['form_type' => 'text', 'name' => '产品编码', 'field' => 'code']
|
||||
], 'model');
|
||||
$query = $search['query'];
|
||||
if (Request::method() == 'POST') {
|
||||
$rows = StockService::getBatchSelect($query['warehouse_id'], $query['product_id'], $query['value'], $query['customer_id']);
|
||||
return ['data' => $rows];
|
||||
}
|
||||
return $this->render([
|
||||
'search' => $search,
|
||||
]);
|
||||
}
|
||||
|
||||
// 获取库存(直营)
|
||||
public function getBatchSelectZYAction()
|
||||
{
|
||||
$search = search_form(['advanced' => ''], [
|
||||
['form_type' => 'text', 'name' => '产品名称', 'field' => 'name'],
|
||||
['form_type' => 'text', 'name' => '产品编码', 'field' => 'code']
|
||||
], 'model');
|
||||
$query = $search['query'];
|
||||
if (Request::method() == 'POST') {
|
||||
$rows = StockService::getBatchSelectZY($query['warehouse_id'], $query['product_id'], $query['value']);
|
||||
return ['data' => $rows];
|
||||
}
|
||||
return $this->render([
|
||||
'search' => $search,
|
||||
], 'getBatchSelect');
|
||||
}
|
||||
|
||||
// 获取库存(全部)
|
||||
public function getBatchSelectAllAction()
|
||||
{
|
||||
$search = search_form(['advanced' => ''], [
|
||||
['form_type' => 'text', 'name' => '产品名称', 'field' => 'name'],
|
||||
['form_type' => 'text', 'name' => '产品编码', 'field' => 'code']
|
||||
], 'model');
|
||||
$query = $search['query'];
|
||||
if (Request::method() == 'POST') {
|
||||
$rows = StockService::getBatchSelectAll($query['warehouse_id'], $query['product_id'], $query['value'], 0);
|
||||
return ['data' => $rows];
|
||||
}
|
||||
return $this->render([
|
||||
'search' => $search,
|
||||
], 'getBatchSelect');
|
||||
}
|
||||
|
||||
// 删除
|
||||
public function deleteAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = Request::get('id');
|
||||
return Form::remove(['code' => 'stock_delivery', 'ids' => $ids]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
<?php namespace Gdoo\Stock\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
use Gdoo\User\Models\User;
|
||||
use Gdoo\Stock\Models\Direct;
|
||||
|
||||
use Gdoo\Model\Grid;
|
||||
use Gdoo\Model\Form;
|
||||
|
||||
use Gdoo\Index\Controllers\WorkflowController;
|
||||
|
||||
class DirectController extends WorkflowController
|
||||
{
|
||||
public $permission = ['dialog', 'importExcel'];
|
||||
|
||||
// 列表
|
||||
public function indexAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'stock_direct',
|
||||
'referer' => 1,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '显示',
|
||||
'action' => 'show',
|
||||
'display' => $this->access['show'],
|
||||
]];
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->orderBy($header['sort'], $header['order']);
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = Direct::$tabs;
|
||||
$header['bys'] = Direct::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 新建
|
||||
public function createAction($action = 'edit')
|
||||
{
|
||||
$id = (int) Request::get('id');
|
||||
$header['action'] = $action;
|
||||
$header['code'] = 'stock_direct';
|
||||
$header['id'] = $id;
|
||||
|
||||
$form = Form::make($header);
|
||||
$tpl = $action == 'print' ? 'print' : 'create';
|
||||
return $this->display([
|
||||
'form' => $form,
|
||||
], $tpl);
|
||||
}
|
||||
|
||||
// 编辑
|
||||
public function editAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
// 审核
|
||||
public function auditAction()
|
||||
{
|
||||
return $this->createAction('audit');
|
||||
}
|
||||
|
||||
// 显示
|
||||
public function showAction()
|
||||
{
|
||||
return $this->createAction('show');
|
||||
}
|
||||
|
||||
// 打印
|
||||
public function printAction()
|
||||
{
|
||||
$id = Request::get('id');
|
||||
$template_id = Request::get('template_id');
|
||||
|
||||
$this->layout = 'layouts.print3';
|
||||
|
||||
$master = DB::table('stock_direct as sd')
|
||||
->leftJoin('customer as c', 'c.id', '=', 'sd.customer_id')
|
||||
->leftJoin('customer_tax as ct', 'ct.id', '=', 'sd.tax_id')
|
||||
->leftJoin('sale_type as st', 'st.id', '=', 'sd.type_id')
|
||||
->selectRaw('sd.*, ct.name as tax_name, c.name as customer_name, st.name as type_name')
|
||||
->where('sd.id', $id)
|
||||
->first();
|
||||
|
||||
$model = DB::table('stock_direct_data as sdd')
|
||||
->leftJoin('stock_direct as sd', 'sd.id', '=', 'sdd.direct_id')
|
||||
->leftJoin('product as p', 'p.id', '=', 'sdd.product_id')
|
||||
->leftJoin('product_unit as pu', 'pu.id', '=', 'p.unit_id')
|
||||
->leftJoin('customer_order_type as cot', 'cot.id', '=', 'sdd.type_id')
|
||||
->leftJoin('warehouse as w', 'w.id', '=', 'sdd.warehouse_id');
|
||||
|
||||
$model->where('sdd.direct_id', $id);
|
||||
|
||||
$model->whereRaw("p.code <> '99001'");
|
||||
|
||||
$rows = $model->selectRaw("
|
||||
sdd.*,
|
||||
p.name as product_name,
|
||||
p.spec as product_spec,
|
||||
cot.name as type_name,
|
||||
pu.name as product_unit,
|
||||
p.material_type,
|
||||
p.product_type,
|
||||
SUBSTRING(batch_sn, 3, 4) as batch_sn,
|
||||
case when right(w.name, 4) = '不满件库' then 'B' else '' end warehouse_type
|
||||
")
|
||||
->orderBy('p.code', 'asc')
|
||||
->get();
|
||||
|
||||
$money = DB::table('stock_direct_data as sdd')
|
||||
->leftJoin('product as p', 'p.id', '=', 'sdd.product_id')
|
||||
->where('sdd.direct_id', $id)
|
||||
->whereRaw("p.code = '99001'")
|
||||
->sum("money");
|
||||
|
||||
$form = [
|
||||
'template' => DB::table('model_template')->where('id', $template_id)->first()
|
||||
];
|
||||
|
||||
return $this->display([
|
||||
'master' => $master,
|
||||
'money' => $money,
|
||||
'rows' => $rows,
|
||||
'form' => $form,
|
||||
], 'print/'.$template_id);
|
||||
}
|
||||
|
||||
public function importExcelAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$customer_id = Request::get('customer_id');
|
||||
$file = Request::file('file');
|
||||
if ($file->isValid()) {
|
||||
$types = DB::table('customer_order_type')->get()->keyBy('name');
|
||||
$customer = DB::table('customer')->where('id', $customer_id)->first();
|
||||
$products = DB::table('customer_price')
|
||||
->leftJoin('product', 'product.id', '=', 'customer_price.product_id')
|
||||
->leftJoin('product_unit', 'product_unit.id', '=', 'product.unit_id')
|
||||
->where('customer_id', $customer_id)
|
||||
->selectRaw('
|
||||
product.*,
|
||||
customer_price.price,
|
||||
product_unit.name as unit_name,
|
||||
product.price'.$customer['type_id'].' as product_price
|
||||
')
|
||||
->get()->keyBy('code');
|
||||
|
||||
/*
|
||||
[0] => 类型
|
||||
[1] => 产品编码
|
||||
[2] => 数量
|
||||
[3] => 单价
|
||||
[4] => 备注
|
||||
*/
|
||||
$rows = readExcel($file->getPathName(), $file->getClientOriginalExtension());
|
||||
$items = [];
|
||||
foreach($rows as $i => $row) {
|
||||
if ($i > 1) {
|
||||
$type = $types[$row[0]];
|
||||
if (empty($type)) {
|
||||
return $this->json('产品编码'.$row[1].':类型('.$row[0].')不存在。');
|
||||
}
|
||||
$product = $products[$row[1]];
|
||||
if (empty($product)) {
|
||||
return $this->json('产品编码'.$row[1].'在客户销售价格中不存在。');
|
||||
}
|
||||
|
||||
if (floatval($row[3]) <> 0) {
|
||||
$price = $row[3];
|
||||
} else {
|
||||
$price = floatval($product['price']) == 0 ? $product['product_price'] : $product['price'];
|
||||
}
|
||||
|
||||
$quantity = $row[2];
|
||||
$item = [
|
||||
'type_id' => $type['id'],
|
||||
'type_id_name' => $type['name'],
|
||||
'product_id' => $product['id'],
|
||||
'product_code' => $product['code'],
|
||||
'product_name' => $product['name'],
|
||||
'product_spec' => $product['spec'],
|
||||
'product_barcode' => $product['barcode'],
|
||||
'product_unit' => $product['unit_name'],
|
||||
'price' => $price,
|
||||
'quantity' => $quantity,
|
||||
'money' => $price * $quantity,
|
||||
'weight' => $product['weight'],
|
||||
'total_weight' => $product['weight'] * $quantity,
|
||||
'remark' => $row[3],
|
||||
];
|
||||
if ($type['id'] == 2) {
|
||||
$item['other_money'] = $item['money'];
|
||||
}
|
||||
$items[] = $item;
|
||||
}
|
||||
}
|
||||
return $this->json($items, true);
|
||||
}
|
||||
}
|
||||
return view('importExcel');
|
||||
}
|
||||
|
||||
// 删除
|
||||
public function deleteAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = Request::get('id');
|
||||
return Form::remove(['code' => 'stock_direct', 'ids' => $ids]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
<?php namespace Gdoo\Stock\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
use Gdoo\Model\Grid;
|
||||
use Gdoo\Model\Form;
|
||||
|
||||
use Gdoo\Stock\Models\WarehouseLocation;
|
||||
|
||||
use Gdoo\Index\Controllers\DefaultController;
|
||||
|
||||
class LocationController extends DefaultController
|
||||
{
|
||||
public $permission = ['dialog', 'dialog2', 'serviceWarehouse'];
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'warehouse_location',
|
||||
'referer' => 1,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '编辑',
|
||||
'action' => 'edit',
|
||||
'display' => $this->access['edit'],
|
||||
]];
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->orderBy($header['sort'], $header['order'])
|
||||
->orderBy('id', 'desc');
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
//['name' => '删除', 'icon' => 'fa-remove', 'action' => 'delete', 'display' => $this->access['delete']],
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = WarehouseLocation::$tabs;
|
||||
$header['bys'] = WarehouseLocation::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 新建客户联系人
|
||||
public function createAction($action = 'edit')
|
||||
{
|
||||
$id = (int)Request::get('id');
|
||||
$form = Form::make(['code' => 'warehouse_location', 'id' => $id, 'action' => $action]);
|
||||
return $this->render([
|
||||
'form' => $form,
|
||||
], 'create');
|
||||
}
|
||||
|
||||
// 创建客户联系人
|
||||
public function editAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹出层信息
|
||||
*/
|
||||
public function dialogAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'warehouse_location',
|
||||
]);
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table']);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
|
||||
$model->where('warehouse_location.warehouse_id', $query['warehouse_id'])
|
||||
->orderBy('warehouse_location.sort', 'asc');
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
$model->select($header['select']);
|
||||
|
||||
$rows = $model->paginate($query['limit']);
|
||||
$items = Grid::dataFilters($rows, $header, function($item) {
|
||||
return $item;
|
||||
});
|
||||
return response()->json($items);
|
||||
}
|
||||
|
||||
return $this->render([
|
||||
'search' => $search,
|
||||
], 'dialog');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取现存量
|
||||
*/
|
||||
public function dialog2Action()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'warehouse_location',
|
||||
]);
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table']);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->where('warehouse_location.status', 1)
|
||||
->orderBy('warehouse_location.sort', 'asc');
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
|
||||
$rows = $model->paginate($query['limit']);
|
||||
$items = Grid::dataFilters($rows, $header, function($item) {
|
||||
return $item;
|
||||
});
|
||||
return response()->json($items);
|
||||
}
|
||||
|
||||
return $this->render([
|
||||
'search' => $search,
|
||||
], 'dialog2');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取仓库货位
|
||||
*/
|
||||
public function serviceWarehouseAction()
|
||||
{
|
||||
$warehouse_id = Request::get('warehouse_id');
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table('warehouse_location')
|
||||
->where('warehouse_location.warehouse_id', $warehouse_id)
|
||||
->where('warehouse_location.status', 1)
|
||||
->orderBy('warehouse_location.sort', 'asc');
|
||||
return response()->json($model->get());
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
public function deleteAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = Request::get('id');
|
||||
return Form::remove(['code' => 'warehouse_location', 'ids' => $ids]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php namespace Gdoo\Stock\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
use Gdoo\User\Models\User;
|
||||
use Gdoo\Stock\Models\Record01;
|
||||
|
||||
use Gdoo\Model\Grid;
|
||||
use Gdoo\Model\Form;
|
||||
|
||||
use Gdoo\Index\Controllers\AuditController;
|
||||
|
||||
class Record01Controller extends AuditController
|
||||
{
|
||||
public $permission = ['dialog'];
|
||||
|
||||
// 列表
|
||||
public function indexAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'stock_record01',
|
||||
'referer' => 1,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '显示',
|
||||
'action' => 'show',
|
||||
'display' => $this->access['show'],
|
||||
]];
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->orderBy($header['sort'], $header['order']);
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
//['name' => '删除', 'icon' => 'fa-remove', 'action' => 'delete', 'display' => $this->access['delete']],
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = Record01::$tabs;
|
||||
$header['bys'] = Record01::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 新建
|
||||
public function createAction($action = 'edit')
|
||||
{
|
||||
$id = (int) Request::get('id');
|
||||
$header['action'] = $action;
|
||||
$header['code'] = 'stock_record01';
|
||||
$header['id'] = $id;
|
||||
|
||||
$form = Form::make($header);
|
||||
$tpl = $action == 'print' ? 'print' : 'create';
|
||||
return $this->display([
|
||||
'form' => $form,
|
||||
], $tpl);
|
||||
}
|
||||
|
||||
// 编辑
|
||||
public function editAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
// 显示
|
||||
public function showAction()
|
||||
{
|
||||
return $this->createAction('show');
|
||||
}
|
||||
|
||||
// 打印
|
||||
public function printAction()
|
||||
{
|
||||
$this->layout = 'layouts.print2';
|
||||
print_prince($this->createAction('print'));
|
||||
}
|
||||
|
||||
// 删除
|
||||
public function deleteAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = Request::get('id');
|
||||
return Form::remove(['code' => 'stock_record01', 'ids' => $ids]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
<?php namespace Gdoo\Stock\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
use Gdoo\User\Models\User;
|
||||
use Gdoo\Stock\Models\Record08;
|
||||
|
||||
use Gdoo\Model\Grid;
|
||||
use Gdoo\Model\Form;
|
||||
|
||||
use Gdoo\Index\Controllers\AuditController;
|
||||
|
||||
class Record08Controller extends AuditController
|
||||
{
|
||||
public $permission = ['dialog', 'importExcel'];
|
||||
|
||||
// 列表
|
||||
public function indexAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'stock_record08',
|
||||
'referer' => 1,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '显示',
|
||||
'action' => 'show',
|
||||
'display' => $this->access['show'],
|
||||
]];
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->orderBy($header['sort'], $header['order']);
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
//['name' => '删除', 'icon' => 'fa-remove', 'action' => 'delete', 'display' => $this->access['delete']],
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = Record08::$tabs;
|
||||
$header['bys'] = Record08::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 新建
|
||||
public function createAction($action = 'edit')
|
||||
{
|
||||
$id = (int) Request::get('id');
|
||||
$header['action'] = $action;
|
||||
$header['code'] = 'stock_record08';
|
||||
$header['id'] = $id;
|
||||
|
||||
$form = Form::make($header);
|
||||
$tpl = $action == 'print' ? 'print' : 'create';
|
||||
return $this->display([
|
||||
'form' => $form,
|
||||
], $tpl);
|
||||
}
|
||||
|
||||
// 编辑
|
||||
public function editAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
// 显示
|
||||
public function showAction()
|
||||
{
|
||||
return $this->createAction('show');
|
||||
}
|
||||
|
||||
// 打印
|
||||
public function printAction()
|
||||
{
|
||||
$this->layout = 'layouts.print2';
|
||||
print_prince($this->createAction('print'));
|
||||
}
|
||||
|
||||
public function importExcelAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$file = Request::file('file');
|
||||
|
||||
if ($file->isValid()) {
|
||||
$products = DB::table('product')
|
||||
->leftJoin('product_unit', 'product_unit.id', '=', 'product.unit_id')
|
||||
->selectRaw('
|
||||
product.*,
|
||||
product_unit.name as unit_name
|
||||
')
|
||||
->get()
|
||||
->keyBy('code');
|
||||
/*
|
||||
[0] => 存货编码
|
||||
[1] => 存货名称
|
||||
[2] => 规格型号
|
||||
[3] => 批次
|
||||
[4] => 数量
|
||||
*/
|
||||
$rows = readExcel($file->getPathName(), $file->getClientOriginalExtension());
|
||||
$items = [];
|
||||
foreach($rows as $i => $row) {
|
||||
if ($i > 1) {
|
||||
if ($row[0]) {
|
||||
$product = $products[$row[0]];
|
||||
if (empty($product)) {
|
||||
return $this->json('产品编码'.$product[0].':产品('.$product[1].')不存在。');
|
||||
}
|
||||
$batch_sn = $row[3];
|
||||
$quantity = $row[4];
|
||||
$item = [
|
||||
'product_id' => $product['id'],
|
||||
'product_code' => $product['code'],
|
||||
'product_name' => $product['name'],
|
||||
'product_spec' => $product['spec'],
|
||||
'product_unit' => $product['unit_name'],
|
||||
'quantity' => $quantity,
|
||||
'batch_sn' => $batch_sn,
|
||||
];
|
||||
$items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->json($items, true);
|
||||
}
|
||||
}
|
||||
return view('importExcel');
|
||||
}
|
||||
|
||||
// 删除
|
||||
public function deleteAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = Request::get('id');
|
||||
return Form::remove(['code' => 'stock_record08', 'ids' => $ids]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
<?php namespace Gdoo\Stock\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
use Gdoo\User\Models\User;
|
||||
use Gdoo\Stock\Models\Record09;
|
||||
|
||||
use Gdoo\Model\Grid;
|
||||
use Gdoo\Model\Form;
|
||||
|
||||
use Gdoo\Index\Controllers\WorkflowController;
|
||||
|
||||
class Record09Controller extends WorkflowController
|
||||
{
|
||||
public $permission = ['dialog'];
|
||||
|
||||
// 列表
|
||||
public function indexAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'stock_record09',
|
||||
'referer' => 1,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '显示',
|
||||
'action' => 'show',
|
||||
'display' => $this->access['show'],
|
||||
]];
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->orderBy($header['sort'], $header['order']);
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
//['name' => '删除', 'icon' => 'fa-remove', 'action' => 'delete', 'display' => $this->access['delete']],
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = Record09::$tabs;
|
||||
$header['bys'] = Record09::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 新建
|
||||
public function createAction($action = 'edit')
|
||||
{
|
||||
$id = (int) Request::get('id');
|
||||
$header['action'] = $action;
|
||||
$header['code'] = 'stock_record09';
|
||||
$header['id'] = $id;
|
||||
|
||||
$form = Form::make($header);
|
||||
$tpl = $action == 'print' ? 'print' : 'create';
|
||||
return $this->display([
|
||||
'form' => $form,
|
||||
], $tpl);
|
||||
}
|
||||
|
||||
// 编辑
|
||||
public function editAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
// 审核
|
||||
public function auditAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
// 显示
|
||||
public function showAction()
|
||||
{
|
||||
return $this->createAction('show');
|
||||
}
|
||||
|
||||
// 打印
|
||||
public function printAction()
|
||||
{
|
||||
$id = Request::get('id');
|
||||
$template_id = Request::get('template_id');
|
||||
|
||||
$this->layout = 'layouts.print3';
|
||||
$master = DB::table('stock_record09 as m')->where('m.id', $id)
|
||||
->leftJoin('stock_type as st', 'st.id', '=', 'm.type_id')
|
||||
->leftJoin('department', 'department.id', '=', 'm.department_id')
|
||||
->leftJoin('warehouse', 'warehouse.id', '=', 'm.warehouse_id')
|
||||
->selectRaw('m.*, st.name as type_name, warehouse.name as warehouse_name, department.name as department_name')
|
||||
->first();
|
||||
|
||||
$rows = DB::table('stock_record09_data as d')
|
||||
->leftJoin('stock_record09 as m', 'm.id', '=', 'd.record09_id')
|
||||
->leftJoin('product as p', 'p.id', '=', 'd.product_id')
|
||||
->leftJoin('product_unit as pu', 'pu.id', '=', 'p.unit_id')
|
||||
->leftJoin('stock_type as st', 'st.id', '=', 'm.type_id')
|
||||
->where('m.id', $id)
|
||||
->selectRaw('
|
||||
d.*,
|
||||
p.name as product_name,
|
||||
p.code as product_code,
|
||||
p.spec as product_spec,
|
||||
st.name as type_name,
|
||||
pu.name as product_unit
|
||||
')
|
||||
->orderBy('p.code', 'asc')
|
||||
->get();
|
||||
|
||||
$form = [
|
||||
'template' => DB::table('model_template')->where('id', $template_id)->first()
|
||||
];
|
||||
|
||||
$tpl = $this->display([
|
||||
'master' => $master,
|
||||
'rows' => $rows,
|
||||
'form' => $form,
|
||||
], 'print/'.$template_id);
|
||||
return $tpl;
|
||||
}
|
||||
|
||||
// 删除
|
||||
public function deleteAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = Request::get('id');
|
||||
return Form::remove(['code' => 'stock_record09', 'ids' => $ids]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,275 @@
|
||||
<?php namespace Gdoo\Stock\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
use Gdoo\User\Models\User;
|
||||
use Gdoo\Stock\Models\Record10;
|
||||
|
||||
use Gdoo\Model\Grid;
|
||||
use Gdoo\Model\Form;
|
||||
|
||||
use Gdoo\Index\Controllers\WorkflowController;
|
||||
|
||||
class Record10Controller extends WorkflowController
|
||||
{
|
||||
public $permission = ['dialog', 'print3'];
|
||||
|
||||
// 列表
|
||||
public function indexAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'stock_record10',
|
||||
'referer' => 1,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '显示',
|
||||
'action' => 'show',
|
||||
'display' => $this->access['show'],
|
||||
]];
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->orderBy($header['sort'], $header['order']);
|
||||
|
||||
// 川南库管登录
|
||||
if (auth()->id() == 2177) {
|
||||
$model->whereIn('stock_record10.warehouse_id', [20001, 20047]);
|
||||
} else {
|
||||
$model->whereNotIn('stock_record10.warehouse_id', [20001, 20047]);
|
||||
}
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
//['name' => '删除', 'icon' => 'fa-remove', 'action' => 'delete', 'display' => $this->access['delete']],
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = Record10::$tabs;
|
||||
$header['bys'] = Record10::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 新建
|
||||
public function createAction($action = 'edit')
|
||||
{
|
||||
$id = (int) Request::get('id');
|
||||
$header['action'] = $action;
|
||||
$header['code'] = 'stock_record10';
|
||||
$header['id'] = $id;
|
||||
|
||||
$form = Form::make($header);
|
||||
|
||||
$tpl = $action == 'print' ? 'print' : 'create';
|
||||
return $this->display([
|
||||
'form' => $form,
|
||||
], $tpl);
|
||||
}
|
||||
|
||||
// 编辑
|
||||
public function editAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
// 审核
|
||||
public function auditAction()
|
||||
{
|
||||
return $this->createAction('audit');
|
||||
}
|
||||
|
||||
// 显示
|
||||
public function showAction()
|
||||
{
|
||||
return $this->createAction('show');
|
||||
}
|
||||
|
||||
// 打印
|
||||
public function print2Action()
|
||||
{
|
||||
$this->layout = 'layouts.print2';
|
||||
$view = $this->createAction('print');
|
||||
$viewData = $view->getData();
|
||||
print_prince($this->createAction('print'));
|
||||
}
|
||||
|
||||
// 显示促销
|
||||
public function printAction()
|
||||
{
|
||||
$id = Request::get('id');
|
||||
$template_id = Request::get('template_id');
|
||||
if ($template_id == 117) {
|
||||
|
||||
$this->layout = 'layouts.print3';
|
||||
|
||||
$master = DB::table('stock_record10 as m')->where('m.id', $id)
|
||||
->leftJoin('stock_type as st', 'st.id', '=', 'm.type_id')
|
||||
->leftJoin('department', 'department.id', '=', 'm.department_id')
|
||||
->leftJoin('warehouse', 'warehouse.id', '=', 'm.warehouse_id')
|
||||
->selectRaw('m.*, st.name as type_name, warehouse.name as warehouse_name, department.name as department_name')
|
||||
->first();
|
||||
|
||||
$rows = DB::table('stock_record10_data as d')
|
||||
->leftJoin('stock_record10 as m', 'm.id', '=', 'd.record10_id')
|
||||
->leftJoin('product as p', 'p.id', '=', 'd.product_id')
|
||||
->leftJoin('product_unit as pu', 'pu.id', '=', 'p.unit_id')
|
||||
->leftJoin('stock_type as st', 'st.id', '=', 'm.type_id')
|
||||
->where('m.id', $id)
|
||||
->selectRaw('
|
||||
d.*,
|
||||
p.name as product_name,
|
||||
p.code as product_code,
|
||||
p.spec as product_spec,
|
||||
st.name as type_name,
|
||||
pu.name as product_unit
|
||||
')
|
||||
->get();
|
||||
|
||||
$form = [
|
||||
'template' => DB::table('model_template')->where('id', $template_id)->first()
|
||||
];
|
||||
|
||||
$tpl = $this->display([
|
||||
'master' => $master,
|
||||
'rows' => $rows,
|
||||
'form' => $form,
|
||||
], 'print/'.$template_id);
|
||||
return $tpl;
|
||||
|
||||
} else {
|
||||
$this->layout = 'layouts.print2';
|
||||
$tpl = $this->createAction('print');
|
||||
print_prince($tpl);
|
||||
}
|
||||
}
|
||||
|
||||
// 显示促销
|
||||
public function print3Action()
|
||||
{
|
||||
$this->layout = 'layouts.print2';
|
||||
$id = Request::get('id');
|
||||
$template_id = Request::get('template_id');
|
||||
if ($template_id == 117) {
|
||||
|
||||
$this->layout = 'layouts.print2';
|
||||
|
||||
$master = DB::table('stock_record10 as m')->where('m.id', $id)
|
||||
->leftJoin('stock_type as st', 'st.id', '=', 'm.type_id')
|
||||
->leftJoin('department', 'department.id', '=', 'm.department_id')
|
||||
->leftJoin('warehouse', 'warehouse.id', '=', 'm.warehouse_id')
|
||||
->selectRaw('m.*, st.name as type_name, warehouse.name as warehouse_name, department.name as department_name')
|
||||
->first();
|
||||
|
||||
$rows = DB::table('stock_record10_data as d')
|
||||
->leftJoin('stock_record10 as m', 'm.id', '=', 'd.record10_id')
|
||||
->leftJoin('product as p', 'p.id', '=', 'd.product_id')
|
||||
->leftJoin('product_unit as pu', 'pu.id', '=', 'p.unit_id')
|
||||
->leftJoin('stock_type as st', 'st.id', '=', 'm.type_id')
|
||||
->where('m.id', $id)
|
||||
->selectRaw('
|
||||
d.*,
|
||||
p.name as product_name,
|
||||
p.code as product_code,
|
||||
p.spec as product_spec,
|
||||
st.name as type_name,
|
||||
pu.name as product_unit
|
||||
')
|
||||
->get();
|
||||
|
||||
$form = [
|
||||
'template' => DB::table('model_template')->where('id', $template_id)->first()
|
||||
];
|
||||
|
||||
$template = "report.fr3";
|
||||
$ver = 3.0;
|
||||
|
||||
$id = (int) Request::get('id');
|
||||
$header['action'] = 'print';
|
||||
$header['code'] = 'stock_record10';
|
||||
$header['id'] = $id;
|
||||
$form = Form::make($header);
|
||||
|
||||
$Tables = [];
|
||||
foreach($form['prints'] as $print) {
|
||||
$fields = [];
|
||||
foreach($print['fields'] as $field) {
|
||||
$type = 'str';
|
||||
$size = 255;
|
||||
if ($field['type'] == 'INT' || $field['type'] == 'TINYINT') {
|
||||
$type = 'int';
|
||||
$size = 0;
|
||||
}
|
||||
if ($field['type'] == 'DATE') {
|
||||
$type = 'str';
|
||||
}
|
||||
if ($field['type'] == 'DECIMAL') {
|
||||
$type = 'float';
|
||||
$size = 0;
|
||||
}
|
||||
$fields[] = ["type" => $type, "size" => $size, "name" => $field['field'], "required" => false];
|
||||
}
|
||||
$Tables[] = [
|
||||
'Name' => $print['name'],
|
||||
'Cols' => $fields,
|
||||
'Data' => $print['data'],
|
||||
];
|
||||
}
|
||||
$jsonObject = [
|
||||
"template" => $template,
|
||||
"ver" => $ver,
|
||||
"Tables" => $Tables,
|
||||
];
|
||||
|
||||
$jsonStr = json_encode($jsonObject);
|
||||
|
||||
|
||||
$tpl = $this->display([
|
||||
'master' => $master,
|
||||
'jsonStr' => $jsonStr,
|
||||
'rows' => $rows,
|
||||
'form' => $form,
|
||||
], 'print3/'.$template_id);
|
||||
return $tpl;
|
||||
|
||||
} else {
|
||||
$tpl = $this->createAction('print');
|
||||
print_prince($tpl);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
public function deleteAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = Request::get('id');
|
||||
return Form::remove(['code' => 'stock_record10', 'ids' => $ids]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
<?php namespace Gdoo\Stock\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
use Gdoo\User\Models\User;
|
||||
use Gdoo\Stock\Models\Record11;
|
||||
|
||||
use Gdoo\Model\Grid;
|
||||
use Gdoo\Model\Form;
|
||||
|
||||
use Gdoo\Index\Controllers\AuditController;
|
||||
|
||||
class Record11Controller extends AuditController
|
||||
{
|
||||
public $permission = ['dialog'];
|
||||
|
||||
// 列表
|
||||
public function indexAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'stock_record11',
|
||||
'referer' => 1,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '显示',
|
||||
'action' => 'show',
|
||||
'display' => $this->access['show'],
|
||||
]];
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->orderBy($header['sort'], $header['order']);
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = Record11::$tabs;
|
||||
$header['bys'] = Record11::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 新建
|
||||
public function createAction($action = 'edit')
|
||||
{
|
||||
$id = (int) Request::get('id');
|
||||
$header['action'] = $action;
|
||||
$header['code'] = 'stock_record11';
|
||||
$header['id'] = $id;
|
||||
|
||||
$form = Form::make($header);
|
||||
$tpl = $action == 'print' ? 'print' : 'create';
|
||||
return $this->display([
|
||||
'form' => $form,
|
||||
], $tpl);
|
||||
}
|
||||
|
||||
// 编辑
|
||||
public function editAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
// 显示
|
||||
public function showAction()
|
||||
{
|
||||
return $this->createAction('show');
|
||||
}
|
||||
|
||||
// 打印
|
||||
public function printAction()
|
||||
{
|
||||
$id = Request::get('id');
|
||||
$template_id = Request::get('template_id');
|
||||
if ($template_id == 115) {
|
||||
|
||||
$this->layout = 'layouts.print3';
|
||||
|
||||
$master = DB::table('stock_record11 as m')->where('m.id', $id)
|
||||
->leftJoin('stock_type as st', 'st.id', '=', 'm.type_id')
|
||||
->leftJoin('department', 'department.id', '=', 'm.department_id')
|
||||
->leftJoin('warehouse', 'warehouse.id', '=', 'm.warehouse_id')
|
||||
->selectRaw('m.*, st.name as type_name, warehouse.name as warehouse_name, department.name as department_name')
|
||||
->first();
|
||||
|
||||
$rows = DB::table('stock_record11_data as d')
|
||||
->leftJoin('stock_record11 as m', 'm.id', '=', 'd.record11_id')
|
||||
->leftJoin('product as p', 'p.id', '=', 'd.product_id')
|
||||
->leftJoin('product_unit as pu', 'pu.id', '=', 'p.unit_id')
|
||||
->leftJoin('stock_type as st', 'st.id', '=', 'm.type_id')
|
||||
->where('m.id', $id)
|
||||
->selectRaw('
|
||||
d.*,
|
||||
p.name as product_name,
|
||||
p.code as product_code,
|
||||
p.spec as product_spec,
|
||||
st.name as type_name,
|
||||
pu.name as product_unit
|
||||
')
|
||||
->orderBy('p.code', 'asc')
|
||||
->get();
|
||||
|
||||
$form = [
|
||||
'template' => DB::table('model_template')->where('id', $template_id)->first()
|
||||
];
|
||||
|
||||
$tpl = $this->display([
|
||||
'master' => $master,
|
||||
'rows' => $rows,
|
||||
'form' => $form,
|
||||
], 'print/'.$template_id);
|
||||
return $tpl;
|
||||
|
||||
} else {
|
||||
$this->layout = 'layouts.print2';
|
||||
$tpl = $this->createAction('print');
|
||||
print_prince($tpl);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
public function deleteAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = Request::get('id');
|
||||
return Form::remove(['code' => 'stock_record11', 'ids' => $ids]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
<?php namespace Gdoo\Stock\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Auth;
|
||||
use Validator;
|
||||
|
||||
use Gdoo\Model\Form;
|
||||
use Gdoo\Model\Grid;
|
||||
|
||||
use Gdoo\User\Models\User;
|
||||
use Gdoo\Produce\Models\Plan;
|
||||
use Gdoo\Produce\Models\Formula;
|
||||
|
||||
use Gdoo\Stock\Services\StockService;
|
||||
|
||||
use Gdoo\Index\Controllers\DefaultController;
|
||||
|
||||
class ReportController extends DefaultController
|
||||
{
|
||||
public $permission = [];
|
||||
|
||||
// 库存明细表
|
||||
public function stockDetailAction()
|
||||
{
|
||||
$sdate = date('Y-m-01');
|
||||
$edate = date('Y-m-d');
|
||||
$search = search_form([
|
||||
'advanced' => 0,
|
||||
], [
|
||||
['form_type' => 'dialog', 'name' => '仓库', 'field' => 'warehouse_id', 'options' => ['url' => 'stock/warehouse/dialog', 'query' => ['multi'=>0]]],
|
||||
['form_type' => 'dialog', 'name' => '产品', 'field' => 'product_id', 'options' => ['url' => 'product/product/dialog', 'query' => ['multi'=>0]]],
|
||||
['form_type' => 'text', 'name' => '批号', 'field' => 'batch_sn', 'options' => []],
|
||||
['form_type' => 'select', 'name' => '内销/外销', 'field' => 'type', 'options' => [['id'=>'内销','name'=>'内销'],['id'=>'外贸','name'=>'外贸']]],
|
||||
//['form_type' => 'select', 'name' => '是否统计批号', 'field' => 'batch', 'value' => 0, 'options' => [['id'=>1,'name'=>'是'],['id'=>0,'name'=>'否']]],
|
||||
['form_type' => 'select', 'name' => '包含不满件库', 'field' => 'bmj', 'value' => 0, 'options' => [['id'=>1,'name'=>'是'],['id'=>0,'name'=>'否']]],
|
||||
['form_type' => 'date2', 'name' => '单据日期', 'field' => 'date', 'value' => [$sdate, $edate], 'options' => []],
|
||||
], 'model');
|
||||
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$fields = [];
|
||||
foreach($search['forms']['field'] as $i => $field) {
|
||||
$fields[$field] = $search['forms']['search'][$i];
|
||||
}
|
||||
$rows = [];
|
||||
if ($query['filter'] == 1) {
|
||||
$rows = StockService::reportOrderStockDetail(
|
||||
$fields['warehouse_id'],
|
||||
$fields['product_id'],
|
||||
$fields['batch_sn'],
|
||||
$fields['type'],
|
||||
$fields['date'][0],
|
||||
$fields['date'][1],
|
||||
auth()->id(),
|
||||
$fields['bmj']
|
||||
);
|
||||
$QmNum = 0;
|
||||
foreach($rows as $i => $row) {
|
||||
if ($row['bill_name'] == '期初') {
|
||||
$QmNum = (float)$row['qm_num'];
|
||||
} else {
|
||||
$QmNum = ((float)$row['rk_num'] - (float)$row['ck_num']) + $QmNum;
|
||||
}
|
||||
$row['qm_num'] = $QmNum;
|
||||
$row['id'] = $i + 1;
|
||||
$rows[$i] = $row;
|
||||
}
|
||||
}
|
||||
return $this->json($rows, true);
|
||||
}
|
||||
$search['table'] = 'material_plan';
|
||||
return $this->display([
|
||||
'search' => $search,
|
||||
'query' => $query,
|
||||
]);
|
||||
}
|
||||
|
||||
// 库存汇总表
|
||||
public function stockTotalAction()
|
||||
{
|
||||
$search = search_form([
|
||||
'advanced' => 0,
|
||||
], [
|
||||
['form_type' => 'dialog', 'name' => '仓库', 'field' => 'warehouse_id', 'options' => ['url' => 'stock/warehouse/dialog', 'query' => ['multi'=>0]]],
|
||||
['form_type' => 'text', 'name' => '存货编码', 'field' => 'product_code', 'options' => []],
|
||||
['form_type' => 'select', 'name' => '内销/外销', 'field' => 'type', 'options' => [['id'=>'1','name'=>'内销'],['id'=>'2','name'=>'外贸']]],
|
||||
['form_type' => 'date2', 'name' => '生产日期', 'field' => 'date', 'value' => [], 'options' => []],
|
||||
['form_type' => 'select', 'name' => '统计批号', 'field' => 'batch', 'value' => 1, 'options' => [['id'=>1,'name'=>'是'],['id'=>0,'name'=>'否']]],
|
||||
['form_type' => 'select', 'name' => '包含不满件库', 'field' => 'bmj', 'value' => 0, 'options' => [['id'=>1,'name'=>'是'],['id'=>0,'name'=>'否']]],
|
||||
|
||||
], 'model');
|
||||
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$fields = [];
|
||||
foreach($search['forms']['field'] as $i => $field) {
|
||||
$fields[$field] = $search['forms']['search'][$i];
|
||||
}
|
||||
$rows = [];
|
||||
if ($query['filter'] == 1) {
|
||||
/*
|
||||
$rows = DB::select('EXEC P_ReportOrderStockTotal ?,?,?,?,?,?,?,?', [
|
||||
$fields['warehouse_id'],
|
||||
$fields['product_code'],
|
||||
$fields['type'],
|
||||
$fields['date'][0],
|
||||
$fields['date'][1],
|
||||
auth()->id(),
|
||||
$fields['batch'],
|
||||
$fields['bmj'],
|
||||
]);
|
||||
*/
|
||||
$rows = StockService::reportOrderStockTotal(
|
||||
$fields['warehouse_id'],
|
||||
$fields['product_code'],
|
||||
$fields['type'],
|
||||
$fields['date'][0],
|
||||
$fields['date'][1],
|
||||
auth()->id(),
|
||||
$fields['batch'],
|
||||
$fields['bmj']
|
||||
);
|
||||
}
|
||||
return $this->json($rows, true);
|
||||
}
|
||||
$search['table'] = 'material_plan';
|
||||
return $this->display([
|
||||
'search' => $search,
|
||||
'query' => $query,
|
||||
]);
|
||||
}
|
||||
|
||||
// 进销存库存汇总表
|
||||
public function stockInOutAction()
|
||||
{
|
||||
$sdate = date('Y-m-01');
|
||||
$edate = date('Y-m-d');
|
||||
$search = search_form([
|
||||
'advanced' => 0,
|
||||
], [
|
||||
['form_type' => 'dialog', 'name' => '仓库', 'field' => 'warehouse_id', 'options' => ['url' => 'stock/warehouse/dialog', 'query' => ['multi'=>0]]],
|
||||
['form_type' => 'dialog', 'name' => '产品', 'field' => 'product_id', 'options' => ['url' => 'product/product/dialog', 'query' => ['multi'=>0]]],
|
||||
['form_type' => 'text', 'name' => '批号', 'field' => 'batch_sn', 'options' => []],
|
||||
['form_type' => 'select', 'name' => '内销/外销', 'field' => 'type', 'options' => [['id'=>'内销','name'=>'内销'],['id'=>'外贸','name'=>'外贸']]],
|
||||
['form_type' => 'select', 'name' => '统计批号', 'field' => 'batch', 'value' => 0, 'options' => [['id'=>1,'name'=>'是'],['id'=>0,'name'=>'否']]],
|
||||
['form_type' => 'select', 'name' => '包含不满件库', 'field' => 'bmj', 'value' => 0, 'options' => [['id'=>1,'name'=>'是'],['id'=>0,'name'=>'否']]],
|
||||
['form_type' => 'date2', 'name' => '单据日期', 'field' => 'date', 'value' => [$sdate, $edate], 'options' => []],
|
||||
], 'model');
|
||||
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$fields = [];
|
||||
foreach($search['forms']['field'] as $i => $field) {
|
||||
$fields[$field] = $search['forms']['search'][$i];
|
||||
}
|
||||
|
||||
$rows = [];
|
||||
if ($query['filter'] == 1) {
|
||||
$rows = StockService::reportOrderStockInOut(
|
||||
$fields['warehouse_id'],
|
||||
$fields['product_id'],
|
||||
$fields['batch_sn'],
|
||||
$fields['type'],
|
||||
$fields['date'][0],
|
||||
$fields['date'][1],
|
||||
auth()->id(),
|
||||
$fields['batch'],
|
||||
$fields['bmj']
|
||||
);
|
||||
}
|
||||
return $this->json($rows, true);
|
||||
}
|
||||
$search['table'] = 'material_plan';
|
||||
return $this->display([
|
||||
'search' => $search,
|
||||
'query' => $query,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php namespace Gdoo\Stock\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
use Gdoo\Model\Grid;
|
||||
use Gdoo\Model\Form;
|
||||
|
||||
use Gdoo\Stock\Models\StockType;
|
||||
|
||||
use Gdoo\Index\Controllers\DefaultController;
|
||||
|
||||
class TypeController extends DefaultController
|
||||
{
|
||||
public $permission = ['dialog'];
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'sale_type',
|
||||
'referer' => 1,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '编辑',
|
||||
'action' => 'edit',
|
||||
'display' => $this->access['edit'],
|
||||
]];
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->orderBy($header['sort'], $header['order'])
|
||||
->orderBy('id', 'desc');
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
['name' => '删除', 'icon' => 'fa-remove', 'action' => 'delete', 'display' => $this->access['delete']],
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = StockType::$tabs;
|
||||
$header['bys'] = StockType::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 新建客户联系人
|
||||
public function createAction()
|
||||
{
|
||||
$id = (int)Request::get('id');
|
||||
$form = Form::make(['code' => 'sale_type', 'id' => $id]);
|
||||
return $this->render([
|
||||
'form' => $form,
|
||||
], 'create');
|
||||
}
|
||||
|
||||
// 创建客户联系人
|
||||
public function editAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹出层信息
|
||||
*/
|
||||
public function dialogAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'sale_type',
|
||||
]);
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table']);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->where('sale_type.status', 1)
|
||||
->orderBy('sale_type.sort', 'asc');
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
|
||||
$rows = $model->paginate($query['limit']);
|
||||
$items = Grid::dataFilters($rows, $header, function($item) {
|
||||
return $item;
|
||||
});
|
||||
return response()->json($items);
|
||||
}
|
||||
|
||||
return $this->render([
|
||||
'search' => $search,
|
||||
], 'dialog');
|
||||
}
|
||||
|
||||
// 删除
|
||||
public function deleteAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = Request::get('id');
|
||||
return Form::remove(['code' => 'sale_type', 'ids' => $ids]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
<?php namespace Gdoo\Stock\Controllers;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
use Gdoo\Model\Grid;
|
||||
use Gdoo\Model\Form;
|
||||
|
||||
use Gdoo\Stock\Models\Warehouse;
|
||||
|
||||
use Gdoo\Index\Controllers\DefaultController;
|
||||
|
||||
class WarehouseController extends DefaultController
|
||||
{
|
||||
public $permission = ['dialog', 'permission'];
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'warehouse',
|
||||
'referer' => 1,
|
||||
'search' => ['by' => ''],
|
||||
]);
|
||||
|
||||
$cols = $header['cols'];
|
||||
|
||||
$cols['actions']['options'] = [[
|
||||
'name' => '编辑',
|
||||
'action' => 'edit',
|
||||
'display' => $this->access['edit'],
|
||||
]];
|
||||
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table'])->setBy($header);
|
||||
foreach ($header['join'] as $join) {
|
||||
$model->leftJoin($join[0], $join[1], $join[2], $join[3]);
|
||||
}
|
||||
$model->orderBy($header['sort'], $header['order'])
|
||||
->orderBy('id', 'desc');
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
$rows = $model->paginate($query['limit'])->appends($query);
|
||||
$items = Grid::dataFilters($rows, $header);
|
||||
return $items->toJson();
|
||||
}
|
||||
|
||||
$header['buttons'] = [
|
||||
['name' => '删除', 'icon' => 'fa-remove', 'action' => 'delete', 'display' => $this->access['delete']],
|
||||
['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1],
|
||||
];
|
||||
$header['cols'] = $cols;
|
||||
$header['tabs'] = Warehouse::$tabs;
|
||||
$header['bys'] = Warehouse::$bys;
|
||||
$header['js'] = Grid::js($header);
|
||||
|
||||
return $this->display([
|
||||
'header' => $header,
|
||||
]);
|
||||
}
|
||||
|
||||
// 新建客户联系人
|
||||
public function createAction()
|
||||
{
|
||||
$id = (int)Request::get('id');
|
||||
$form = Form::make(['code' => 'warehouse', 'id' => $id]);
|
||||
return $this->render([
|
||||
'form' => $form,
|
||||
], 'create');
|
||||
}
|
||||
|
||||
// 创建客户联系人
|
||||
public function editAction()
|
||||
{
|
||||
return $this->createAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* 弹出层信息
|
||||
*/
|
||||
public function dialogAction()
|
||||
{
|
||||
$header = Grid::header([
|
||||
'code' => 'warehouse',
|
||||
]);
|
||||
$search = $header['search_form'];
|
||||
$query = $search['query'];
|
||||
|
||||
if (Request::method() == 'POST') {
|
||||
$model = DB::table($header['table']);
|
||||
$model->leftJoin('user_warehouse', 'user_warehouse.warehouse_id', '=', 'warehouse.id')
|
||||
->where('user_warehouse.user_id', auth()->id());
|
||||
|
||||
$model->where('warehouse.status', 1)
|
||||
->orderBy('warehouse.id', 'asc');
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$model->select($header['select']);
|
||||
|
||||
$rows = $model->paginate($query['limit']);
|
||||
|
||||
$_locations = DB::table('warehouse_location')->get();
|
||||
$locations = [];
|
||||
foreach ($_locations as $_location) {
|
||||
$locations[$_location['warehouse_id']][] = $_location;
|
||||
}
|
||||
|
||||
$items = Grid::dataFilters($rows, $header, function($item) use($locations) {
|
||||
$item['pos'] = (array)$locations[$item['id']];
|
||||
return $item;
|
||||
});
|
||||
return response()->json($items);
|
||||
}
|
||||
|
||||
return $this->render([
|
||||
'search' => $search,
|
||||
], 'dialog');
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限设置
|
||||
*/
|
||||
public function permissionAction()
|
||||
{
|
||||
$gets = Request::all();
|
||||
if (Request::method() == 'POST') {
|
||||
$user_id = $gets['user_id'];
|
||||
$rows = $gets['rows'];
|
||||
$users = DB::table('user_warehouse')
|
||||
->where('user_id', $user_id)
|
||||
->pluck('id', 'warehouse_id');
|
||||
foreach($rows as $row) {
|
||||
if (empty($users[$row['id']])) {
|
||||
DB::table('user_warehouse')->insert([
|
||||
'user_id' => $user_id,
|
||||
'warehouse_id' => $row['id']
|
||||
]);
|
||||
} else {
|
||||
unset($users[$row['id']]);
|
||||
}
|
||||
}
|
||||
foreach($users as $warehouse_id) {
|
||||
DB::table('user_warehouse')->where('id', $warehouse_id)->delete();
|
||||
}
|
||||
return $this->json('仓库权限设置成功。', true);
|
||||
}
|
||||
$rows = DB::table('warehouse')->orderBy('id', 'asc')->get(['id', 'code', 'name']);
|
||||
$users = DB::table('user_warehouse')->where('user_id', $gets['user_id'])->pluck('id', 'warehouse_id');
|
||||
return $this->render([
|
||||
'rows' => $rows,
|
||||
'users' => $users,
|
||||
]);
|
||||
}
|
||||
|
||||
// 删除
|
||||
public function deleteAction()
|
||||
{
|
||||
if (Request::method() == 'POST') {
|
||||
$ids = Request::get('id');
|
||||
return Form::remove(['code' => 'warehouse', 'ids' => $ids]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php namespace Gdoo\Stock\Hooks;
|
||||
|
||||
use DB;
|
||||
use Exception;
|
||||
|
||||
class AllocationHook
|
||||
{
|
||||
public function onBeforeForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeStore($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeAudit($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_allocation as sa')
|
||||
->leftJoin('warehouse as w', 'w.id', '=', 'sa.in_warehouse_id')
|
||||
->leftJoin('warehouse as w2', 'w2.id', '=', 'sa.out_warehouse_id')
|
||||
->leftJoin('department as d', 'd.id', '=', 'sa.in_department_id')
|
||||
->leftJoin('department as d2', 'd2.id', '=', 'sa.out_department_id')
|
||||
->leftJoin('stock_type as st', 'st.id', '=', 'sa.in_type_id')
|
||||
->leftJoin('stock_type as st2', 'st2.id', '=', 'sa.out_type_id')
|
||||
->where('sa.id', $id)
|
||||
->selectRaw('
|
||||
sa.*,
|
||||
st.code as in_type_code,
|
||||
st2.code as out_type_code,
|
||||
d.code as in_department_code,
|
||||
d2.code as out_department_code,
|
||||
w.code as in_warehouse_code,
|
||||
w2.code as out_warehouse_code
|
||||
')
|
||||
->first();
|
||||
|
||||
$rows = DB::table('stock_allocation_data')
|
||||
->leftJoin('product', 'product.id', '=', 'stock_allocation_data.product_id')
|
||||
->where('stock_allocation_data.allocation_id', $id)
|
||||
->get(['stock_allocation_data.*', 'product.code as product_code']);
|
||||
// 同步数据到yonyou
|
||||
$ret = plugin_sync_api('postTransVouch', ['master' => $master, 'rows' => $rows]);
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
}
|
||||
abort_error($ret['msg']);
|
||||
}
|
||||
|
||||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_allocation')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'TransVouch', 'field' => 'cTVCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在其他入库单['.$master['sn'].']无法弃审。');
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterStore($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeDelete($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
<?php namespace Gdoo\Stock\Hooks;
|
||||
|
||||
use DB;
|
||||
use Exception;
|
||||
|
||||
class CancelHook
|
||||
{
|
||||
public function onBeforeForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeStore($params) {
|
||||
$datas = $params['datas'];
|
||||
// 处理生产日期
|
||||
foreach($datas as $i => $data) {
|
||||
if ($data['table'] == 'stock_cancel_data') {
|
||||
foreach($data['data'] as $j => $row) {
|
||||
if ($row['batch_sn']) {
|
||||
$batch_sn = substr($row['batch_sn'], 0, 6);
|
||||
$sn = str_split($batch_sn, 2);
|
||||
$row['batch_date'] = date("Y-m-d", mktime(0, 0, 0, $sn[1], $sn[2], $sn[0]));
|
||||
}
|
||||
if ($row['quantity'] >= 0) {
|
||||
abort_error('产品编码['.$row['product_code'].']数量必须是负数。');
|
||||
}
|
||||
$data['data'][$j] = $row;
|
||||
}
|
||||
$datas[$i] = $data;
|
||||
}
|
||||
}
|
||||
$params['datas'] = $datas;
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeAudit($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_cancel')
|
||||
->leftJoin('customer', 'customer.id', '=', 'stock_cancel.customer_id')
|
||||
->leftJoin('customer_tax', 'customer_tax.id', '=', 'stock_cancel.tax_id')
|
||||
->leftJoin('customer_region', 'customer_region.id', '=', 'customer.region_id')
|
||||
->leftJoin('department', 'department.id', '=', 'customer_tax.department_id')
|
||||
->leftJoin('sale_type', 'sale_type.id', '=', 'stock_cancel.type_id')
|
||||
->where('stock_cancel.id', $id)
|
||||
->first([
|
||||
'stock_cancel.*',
|
||||
'sale_type.code as sale_code',
|
||||
'department.code as department_code',
|
||||
'customer_tax.code as customer_code',
|
||||
'customer.region_id',
|
||||
'customer_region.owner_user_id as salesman_id',
|
||||
'customer.region2_id',
|
||||
'customer.region3_id'
|
||||
]);
|
||||
|
||||
$sql = "select d.id,d.type_id,d.price,d.quantity,d.money,d.other_money,
|
||||
d.batch_sn,
|
||||
d.poscode,
|
||||
d.remark,
|
||||
d.product_id,
|
||||
d.warehouse_id,
|
||||
product.code as product_code,
|
||||
product.name as product_name,
|
||||
d.total_weight,
|
||||
warehouse.code as warehouse_code,
|
||||
|
||||
null as fee_category_name,
|
||||
null as fee_category_id,
|
||||
null as fee_src_type_id,
|
||||
null as fee_src_sn,
|
||||
null as fee_src_id,
|
||||
null as promotion_sn,
|
||||
null as row_index
|
||||
|
||||
from stock_cancel_data as d
|
||||
left Join product on product.id = d.product_id
|
||||
left Join warehouse on warehouse.id = d.warehouse_id
|
||||
where d.cancel_id = ".$id."
|
||||
and product.code <> '99001'
|
||||
|
||||
union
|
||||
|
||||
select t.* from (
|
||||
select d.id,
|
||||
null as type_id,
|
||||
null as price,
|
||||
null as quantity,
|
||||
SUM(d.money) OVER(PARTITION BY product.code) as money,
|
||||
SUM(d.other_money) OVER(PARTITION BY product.code) as other_money,
|
||||
d.batch_sn,
|
||||
d.poscode,
|
||||
d.remark,
|
||||
null as product_id,
|
||||
null as warehouse_id,
|
||||
product.code as product_code,
|
||||
product.name as product_name,
|
||||
null as total_weight,
|
||||
null as warehouse_code,
|
||||
ccc.name as fee_category_name,
|
||||
d.fee_category_id as fee_category_id,
|
||||
d.fee_src_type_id as fee_src_type_id,
|
||||
d.fee_src_sn as fee_src_sn,
|
||||
d.fee_src_id as fee_src_id,
|
||||
d.promotion_sn as promotion_sn,
|
||||
row_number() over(partition by product.code order by d.id desc) row_index
|
||||
from stock_cancel_data as d
|
||||
left Join product on product.id = d.product_id
|
||||
left Join customer_cost_category as ccc on ccc.id = d.fee_category_id
|
||||
where d.cancel_id = ".$id." and product.code = '99001'
|
||||
) t where t.row_index = 1";
|
||||
$rows = DB::select($sql);
|
||||
|
||||
// 同步数据到yonyou
|
||||
$ret = plugin_sync_api('postCancelOrder', ['master' => $master, 'rows' => $rows]);
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
}
|
||||
abort_error($ret['msg']);
|
||||
}
|
||||
|
||||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_cancel')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'DispatchList', 'field' => 'cDLCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在退货申请['.$master['sn'].']无法弃审。');
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterStore($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeDelete($params) {
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php namespace Gdoo\Stock\Hooks;
|
||||
|
||||
class DeliveryDataHook
|
||||
{
|
||||
public function onBeforeForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onQueryForm($params) {
|
||||
$q = $params['q'];
|
||||
$q->leftJoin('customer_order_type as cot', 'cot.id', '=', 'stock_delivery_data.type_id')
|
||||
->orderBy('cot.sort', 'asc')
|
||||
->orderBy('product_id_product.code', 'asc')
|
||||
->orderBy('stock_delivery_data.id', 'asc');
|
||||
|
||||
$params['q'] = $q;
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterForm($arguments) {
|
||||
return $arguments;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
<?php namespace Gdoo\Stock\Hooks;
|
||||
|
||||
use Log;
|
||||
use DB;
|
||||
use Exception;
|
||||
|
||||
use Gdoo\Stock\Services\StockService;
|
||||
|
||||
class DeliveryHook
|
||||
{
|
||||
public function onBeforeForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeStore($params) {
|
||||
$datas = $params['datas'];
|
||||
foreach($datas as $data) {
|
||||
if ($data['table'] == 'stock_delivery_data') {
|
||||
foreach($data['data'] as $row) {
|
||||
if ($row['product_id'] == '20226') {
|
||||
continue;
|
||||
}
|
||||
// 检查库存
|
||||
$exec = StockService::verfyInvoiceBatch($row['warehouse_id'], $row['product_id'], $row['batch_sn'], $row['poscode'], $row['id'], 0, 0);
|
||||
if ($exec[0]['ky_num'] < $row['quantity']) {
|
||||
$error = [];
|
||||
$error[] = '存货编码为:'.$row['product_code'];
|
||||
$error[] = '仓库名称为:'.$row['warehouse_id_name'];
|
||||
$error[] = '批次为:'.$row['batch_sn'];
|
||||
$error[] = '货位为:'.$row['poscode'];
|
||||
$error[] = '发货数量:'.$row['quantity'];
|
||||
$error[] = '可用量为:'.$exec[0]['ky_num'];
|
||||
abort_error(join("<br>", $error));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeAudit($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_delivery')
|
||||
->leftJoin('customer', 'customer.id', '=', 'stock_delivery.customer_id')
|
||||
->leftJoin('customer_tax', 'customer_tax.id', '=', 'stock_delivery.tax_id')
|
||||
->leftJoin('customer_region', 'customer_region.id', '=', 'customer.region_id')
|
||||
->leftJoin('department', 'department.id', '=', 'customer_tax.department_id')
|
||||
->leftJoin('sale_type', 'sale_type.id', '=', 'stock_delivery.type_id')
|
||||
->where('stock_delivery.id', $id)
|
||||
->first([
|
||||
'stock_delivery.*',
|
||||
'sale_type.code as sale_code',
|
||||
'department.code as department_code',
|
||||
'customer_tax.code as customer_code',
|
||||
'customer.region_id',
|
||||
'customer_region.owner_user_id as salesman_id',
|
||||
'customer.region2_id',
|
||||
'customer.region3_id'
|
||||
]);
|
||||
|
||||
$sql = "select sdd.id,sdd.type_id,sdd.price,sdd.quantity,sdd.money,sdd.other_money,
|
||||
sdd.batch_sn,
|
||||
sdd.poscode,
|
||||
sdd.remark,
|
||||
sdd.product_id,
|
||||
sdd.warehouse_id,
|
||||
product.code as product_code,
|
||||
product.name as product_name,
|
||||
sdd.total_weight,
|
||||
warehouse.code as warehouse_code,
|
||||
|
||||
null as fee_category_name,
|
||||
null as fee_category_id,
|
||||
null as fee_src_type_id,
|
||||
null as fee_src_sn,
|
||||
null as fee_src_id,
|
||||
null as promotion_sn,
|
||||
null as row_index
|
||||
|
||||
from stock_delivery_data as sdd
|
||||
left Join product on product.id = sdd.product_id
|
||||
left Join warehouse on warehouse.id = sdd.warehouse_id
|
||||
where sdd.delivery_id = ".$id."
|
||||
and product.code <> '99001'
|
||||
|
||||
union
|
||||
|
||||
select t.* from (
|
||||
select sdd.id,
|
||||
null as type_id,
|
||||
null as price,
|
||||
null as quantity,
|
||||
SUM(sdd.money) OVER(PARTITION BY product.code) as money,
|
||||
SUM(sdd.other_money) OVER(PARTITION BY product.code) as other_money,
|
||||
sdd.batch_sn,
|
||||
sdd.poscode,
|
||||
sdd.remark,
|
||||
null as product_id,
|
||||
null as warehouse_id,
|
||||
product.code as product_code,
|
||||
product.name as product_name,
|
||||
null as total_weight,
|
||||
null as warehouse_code,
|
||||
ccc.name as fee_category_name,
|
||||
sdd.fee_category_id as fee_category_id,
|
||||
sdd.fee_src_type_id as fee_src_type_id,
|
||||
sdd.fee_src_sn as fee_src_sn,
|
||||
sdd.fee_src_id as fee_src_id,
|
||||
sdd.promotion_sn as promotion_sn,
|
||||
row_number() over(partition by product.code order by sdd.id desc) row_index
|
||||
from stock_delivery_data as sdd
|
||||
left Join product on product.id = sdd.product_id
|
||||
left Join customer_cost_category as ccc on ccc.id = sdd.fee_category_id
|
||||
where sdd.delivery_id = ".$id." and product.code = '99001'
|
||||
) t where t.row_index = 1";
|
||||
$rows = DB::select($sql);
|
||||
|
||||
// 检查库存
|
||||
foreach($rows as $row) {
|
||||
if ($row['product_code'] == '99001') {
|
||||
continue;
|
||||
}
|
||||
// 检查库存
|
||||
$exec = StockService::verfyInvoiceBatch($row['warehouse_id'], $row['product_id'], $row['batch_sn'], $row['poscode'], $row['id'], 0, 0);
|
||||
if ($exec[0]['ky_num'] < $row['quantity']) {
|
||||
abort_error('存货编码为['.$row['product_code'].']的存货库存不足。');
|
||||
}
|
||||
}
|
||||
|
||||
// 同步数据到yonyou
|
||||
$ret = plugin_sync_api('postDelivery', ['master' => $master, 'rows' => $rows]);
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
}
|
||||
abort_error($ret['msg']);
|
||||
}
|
||||
|
||||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_delivery')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'DispatchList', 'field' => 'cDLCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在发货单['.$master['sn'].']无法弃审。');
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterStore($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeDelete($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
<?php namespace Gdoo\Stock\Hooks;
|
||||
|
||||
use DB;
|
||||
use Exception;
|
||||
|
||||
use Gdoo\Stock\Services\StockService;
|
||||
|
||||
class DirectHook
|
||||
{
|
||||
public function onBeforeForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeStore($params) {
|
||||
|
||||
$master = $params['master'];
|
||||
$warehouse = DB::table('warehouse')->find($master['warehouse_id']);
|
||||
|
||||
$datas = $params['datas'];
|
||||
foreach($datas as $data) {
|
||||
if ($data['table'] == 'stock_direct_data') {
|
||||
foreach($data['data'] as $row) {
|
||||
if ($row['product_id'] == '20226') {
|
||||
continue;
|
||||
}
|
||||
// 检查库存
|
||||
$exec = StockService::verfyInvoiceBatch($master['warehouse_id'], $row['product_id'], $row['batch_sn'], $row['poscode'], 0, 0, $row['id']);
|
||||
if ($exec[0]['ky_num'] < $row['quantity']) {
|
||||
$error = [];
|
||||
$error[] = '存货编码为:'.$row['product_code'];
|
||||
$error[] = '仓库名称为:'.$warehouse['name'];
|
||||
$error[] = '批次为:'.$row['batch_sn'];
|
||||
$error[] = '货位为:'.$row['poscode'];
|
||||
$error[] = '发货数量:'.$row['quantity'];
|
||||
$error[] = '可用量为:'.$exec[0]['ky_num'];
|
||||
abort_error(join("<br>", $error));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeAudit($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_direct')
|
||||
->leftJoin('customer', 'customer.id', '=', 'stock_direct.customer_id')
|
||||
->leftJoin('customer_tax', 'customer_tax.id', '=', 'stock_direct.tax_id')
|
||||
->leftJoin('customer_region', 'customer_region.id', '=', 'customer.region_id')
|
||||
->leftJoin('department', 'department.id', '=', 'customer_tax.department_id')
|
||||
->leftJoin('warehouse', 'warehouse.id', '=', 'stock_direct.warehouse_id')
|
||||
->leftJoin('sale_type', 'sale_type.id', '=', 'stock_direct.type_id')
|
||||
->where('stock_direct.id', $id)
|
||||
->first([
|
||||
'stock_direct.*',
|
||||
'sale_type.code as sale_code',
|
||||
'department.code as department_code',
|
||||
'customer_tax.code as customer_code',
|
||||
'warehouse.code as warehouse_code',
|
||||
'customer.region_id',
|
||||
'customer_region.owner_user_id as salesman_id',
|
||||
'customer.region2_id',
|
||||
'customer.region3_id'
|
||||
]);
|
||||
|
||||
$sql = DB::table('stock_direct_data')
|
||||
->leftJoin('product', 'product.id', '=', 'stock_direct_data.product_id')
|
||||
->where('stock_direct_data.direct_id', $id)
|
||||
->where('product.code', '<>', '99001')
|
||||
->selectRaw('
|
||||
stock_direct_data.id,
|
||||
stock_direct_data.type_id,
|
||||
stock_direct_data.price,
|
||||
stock_direct_data.quantity,
|
||||
stock_direct_data.money,
|
||||
stock_direct_data.other_money,
|
||||
stock_direct_data.batch_sn,
|
||||
stock_direct_data.poscode,
|
||||
stock_direct_data.remark,
|
||||
stock_direct_data.product_id,
|
||||
product.code as product_code,
|
||||
product.name as product_name,
|
||||
stock_direct_data.total_weight
|
||||
');
|
||||
|
||||
$rows = DB::table('stock_direct_data')
|
||||
->leftJoin('product', 'product.id', '=', 'stock_direct_data.product_id')
|
||||
->where('stock_direct_data.direct_id', $id)
|
||||
->where('product.code', '99001')
|
||||
->selectRaw('
|
||||
max(stock_direct_data.id) as id,
|
||||
null as type_id,
|
||||
null as price,
|
||||
null as quantity,
|
||||
sum(stock_direct_data.money) as money,
|
||||
sum(stock_direct_data.other_money) as other_money,
|
||||
stock_direct_data.batch_sn,
|
||||
stock_direct_data.poscode,
|
||||
stock_direct_data.remark,
|
||||
null as product_id,
|
||||
product.code as product_code,
|
||||
product.name as product_name,
|
||||
null as total_weight
|
||||
')
|
||||
->groupBy('product.name', 'product.code', 'stock_direct_data.batch_sn', 'stock_direct_data.poscode', 'stock_direct_data.remark')
|
||||
->union($sql)->get();
|
||||
|
||||
// 检查库存
|
||||
foreach($rows as $row) {
|
||||
if ($row['product_code'] == '99001') {
|
||||
continue;
|
||||
}
|
||||
$exec = StockService::verfyInvoiceBatch($master['warehouse_id'], $row['product_id'], $row['batch_sn'], $row['poscode'], 0, 0, $row['id']);
|
||||
if ($exec[0]['ky_num'] < $row['quantity']) {
|
||||
abort_error('存货编码为['.$row['product_code'].']的存货库存不足。');
|
||||
}
|
||||
}
|
||||
|
||||
// 同步数据到yonyou
|
||||
$ret = plugin_sync_api('postDeliveryZY', ['master' => $master, 'rows' => $rows]);
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
}
|
||||
abort_error($ret['msg']);
|
||||
}
|
||||
|
||||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_direct')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'DispatchList', 'field' => 'cDLCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在发货单(直营)['.$master['sn'].']无法弃审。');
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterStore($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeDelete($params) {
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php namespace Gdoo\Stock\Hooks;
|
||||
|
||||
use DB;
|
||||
use Exception;
|
||||
|
||||
class Record01Hook
|
||||
{
|
||||
public function onBeforeForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeStore($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeAudit($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_record01')
|
||||
->leftJoin('warehouse', 'warehouse.id', '=', 'stock_record01.warehouse_id')
|
||||
->leftJoin('department', 'department.id', '=', 'stock_record01.department_id')
|
||||
->leftJoin('stock_type', 'stock_type.id', '=', 'stock_record01.type_id')
|
||||
->leftJoin('supplier', 'supplier.id', '=', 'stock_record01.supplier_id')
|
||||
->where('stock_record01.id', $id)
|
||||
->first([
|
||||
'stock_record01.*',
|
||||
'department.code as department_code',
|
||||
'stock_type.code as type_code',
|
||||
'supplier.code as supplier_code',
|
||||
'warehouse.code as warehouse_code',
|
||||
]);
|
||||
|
||||
$rows = DB::table('stock_record01_data')
|
||||
->leftJoin('product', 'product.id', '=', 'stock_record01_data.product_id')
|
||||
->where('stock_record01_data.record01_id', $id)
|
||||
->get(['stock_record01_data.*', 'product.code as product_code']);
|
||||
// 同步数据到yonyou
|
||||
$ret = plugin_sync_api('postRecord01', ['master' => $master, 'rows' => $rows]);
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
}
|
||||
abort_error($ret['msg']);
|
||||
}
|
||||
|
||||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_record01')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'Rdrecord01', 'field' => 'cCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在采购单['.$master['sn'].']无法弃审。');
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterStore($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeDelete($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php namespace Gdoo\Stock\Hooks;
|
||||
|
||||
use DB;
|
||||
use Exception;
|
||||
|
||||
class Record08Hook
|
||||
{
|
||||
public function onBeforeForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeStore($params) {
|
||||
$datas = $params['datas'];
|
||||
// 处理生产日期
|
||||
foreach($datas as $i => $data) {
|
||||
if ($data['table'] == 'stock_record08_data') {
|
||||
foreach($data['data'] as $j => $row) {
|
||||
if ($row['batch_sn']) {
|
||||
$batch_sn = substr($row['batch_sn'], 0, 6);
|
||||
$sn = str_split($batch_sn, 2);
|
||||
$row['batch_date'] = date("Y-m-d", mktime(0, 0, 0, $sn[1], $sn[2], $sn[0]));
|
||||
}
|
||||
$data['data'][$j] = $row;
|
||||
}
|
||||
$datas[$i] = $data;
|
||||
}
|
||||
}
|
||||
$params['datas'] = $datas;
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeAudit($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_record08')
|
||||
->leftJoin('warehouse', 'warehouse.id', '=', 'stock_record08.warehouse_id')
|
||||
->leftJoin('department', 'department.id', '=', 'stock_record08.department_id')
|
||||
->leftJoin('stock_type', 'stock_type.id', '=', 'stock_record08.type_id')
|
||||
->where('stock_record08.id', $id)
|
||||
->first(['stock_record08.*', 'stock_type.code as type_code', 'department.code as department_code', 'warehouse.code as warehouse_code']);
|
||||
|
||||
$rows = DB::table('stock_record08_data')
|
||||
->leftJoin('product', 'product.id', '=', 'stock_record08_data.product_id')
|
||||
->where('stock_record08_data.record08_id', $id)
|
||||
->get(['stock_record08_data.*', 'product.code as product_code']);
|
||||
// 同步数据到yonyou
|
||||
$ret = plugin_sync_api('postRecord08', ['master' => $master, 'rows' => $rows]);
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
}
|
||||
abort_error($ret['msg']);
|
||||
}
|
||||
|
||||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_record08')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'Rdrecord08', 'field' => 'cCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在其他入库单['.$master['sn'].']无法弃审。');
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterStore($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeDelete($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php namespace Gdoo\Stock\Hooks;
|
||||
|
||||
use DB;
|
||||
use Exception;
|
||||
|
||||
use Gdoo\Stock\Services\StockService;
|
||||
|
||||
class Record09Hook
|
||||
{
|
||||
public function onBeforeForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeStore($params) {
|
||||
|
||||
$master = $params['master'];
|
||||
$warehouse = DB::table('warehouse')->find($master['warehouse_id']);
|
||||
|
||||
$datas = $params['datas'];
|
||||
foreach($datas as $data) {
|
||||
if ($data['table'] == 'stock_record09_data') {
|
||||
foreach($data['data'] as $row) {
|
||||
// 检查库存
|
||||
$exec = StockService::verfyInvoiceBatch($master['warehouse_id'], $row['product_id'], $row['batch_sn'], $row['poscode'], 0, $row['id'], 0);
|
||||
if ($exec[0]['ky_num'] < $row['quantity']) {
|
||||
$error = [];
|
||||
$error[] = '存货编码为:'.$row['product_code'];
|
||||
$error[] = '仓库名称为:'.$warehouse['name'];
|
||||
$error[] = '批次为:'.$row['batch_sn'];
|
||||
$error[] = '货位为:'.$row['poscode'];
|
||||
$error[] = '发货数量:'.$row['quantity'];
|
||||
$error[] = '可用量为:'.$exec[0]['ky_num'];
|
||||
abort_error(join("<br>", $error));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeAudit($params) {
|
||||
$id = $params['id'];
|
||||
|
||||
$master = DB::table('stock_record09')
|
||||
->leftJoin('warehouse', 'warehouse.id', '=', 'stock_record09.warehouse_id')
|
||||
->leftJoin('department', 'department.id', '=', 'stock_record09.department_id')
|
||||
->leftJoin('stock_type', 'stock_type.id', '=', 'stock_record09.type_id')
|
||||
->where('stock_record09.id', $id)
|
||||
->first(['stock_record09.*', 'stock_type.code as type_code', 'department.code as department_code', 'warehouse.code as warehouse_code']);
|
||||
|
||||
$rows = DB::table('stock_record09_data')
|
||||
->leftJoin('product', 'product.id', '=', 'stock_record09_data.product_id')
|
||||
->where('stock_record09_data.record09_id', $id)
|
||||
->selectRaw('
|
||||
stock_record09_data.*,
|
||||
product.code as product_code,
|
||||
product.weight * stock_record09_data.quantity as total_weight
|
||||
')
|
||||
->get();
|
||||
$master['total_weight'] = $rows->sum('total_weight');
|
||||
|
||||
// 检查库存
|
||||
foreach($rows as $row) {
|
||||
$exec = StockService::verfyInvoiceBatch($master['warehouse_id'], $row['product_id'], $row['batch_sn'], $row['poscode'], 0, $row['id'], 0);
|
||||
if ($exec[0]['ky_num'] < $row['quantity']) {
|
||||
abort_error('存货编码为['.$row['product_code'].']的存货库存不足。');
|
||||
}
|
||||
}
|
||||
|
||||
if ($master['type_id'] == 2) {
|
||||
$post_type = 'postSampleDelivery';
|
||||
} else {
|
||||
$post_type = 'postRecord09';
|
||||
}
|
||||
// 同步数据到yonyou
|
||||
$ret = plugin_sync_api($post_type, ['master' => $master, 'rows' => $rows]);
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
}
|
||||
abort_error($ret['msg']);
|
||||
}
|
||||
|
||||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
|
||||
$master = DB::table('stock_record09')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
if ($master['type_id'] == 2) {
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'DispatchList', 'field' => 'cDLCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在样品申请单['.$master['sn'].']无法弃审。');
|
||||
}
|
||||
} else {
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'Rdrecord09', 'field' => 'cCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在其他出库单['.$master['sn'].']无法弃审。');
|
||||
}
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterStore($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeDelete($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php namespace Gdoo\Stock\Hooks;
|
||||
|
||||
class Record10DataHook
|
||||
{
|
||||
public function onBeforeForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onQueryForm($params) {
|
||||
$q = $params['q'];
|
||||
$q->orderBy('stock_record10_data.batch_sn', 'asc')
|
||||
->orderBy('product_id_product.code', 'asc');
|
||||
|
||||
$params['q'] = $q;
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterForm($arguments) {
|
||||
return $arguments;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php namespace Gdoo\Stock\Hooks;
|
||||
|
||||
use DB;
|
||||
use Exception;
|
||||
|
||||
class Record10Hook
|
||||
{
|
||||
public function onBeforeForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBillSeqNo($params) {
|
||||
// 川南库管独立编号
|
||||
if (auth()->id() == 2177) {
|
||||
$params['rule'] = $params['rule'].'11';
|
||||
} else {
|
||||
$params['rule'] = $params['rule'].'10';
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforePage($params) {
|
||||
// 川南库管登录
|
||||
if (auth()->id() == 2177) {
|
||||
$params['q']->whereIn('stock_record10.warehouse_id', [20001, 20047]);
|
||||
} else {
|
||||
$params['q']->whereNotIn('stock_record10.warehouse_id', [20001, 20047]);
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeStore($params) {
|
||||
$datas = $params['datas'];
|
||||
// 处理生产日期
|
||||
foreach($datas as $i => $data) {
|
||||
if ($data['table'] == 'stock_record10_data') {
|
||||
foreach($data['data'] as $j => $row) {
|
||||
if ($row['batch_sn']) {
|
||||
$batch_sn = substr($row['batch_sn'], 0, 6);
|
||||
$sn = str_split($batch_sn, 2);
|
||||
$row['batch_date'] = date("Y-m-d", mktime(0, 0, 0, $sn[1], $sn[2], $sn[0]));
|
||||
}
|
||||
$data['data'][$j] = $row;
|
||||
}
|
||||
$datas[$i] = $data;
|
||||
}
|
||||
}
|
||||
$params['datas'] = $datas;
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeAudit($params) {
|
||||
$id = $params['id'];
|
||||
|
||||
$master = DB::table('stock_record10')
|
||||
->leftJoin('warehouse', 'warehouse.id', '=', 'stock_record10.warehouse_id')
|
||||
->leftJoin('department', 'department.id', '=', 'stock_record10.department_id')
|
||||
->leftJoin('stock_type', 'stock_type.id', '=', 'stock_record10.type_id')
|
||||
->where('stock_record10.id', $id)
|
||||
->first(['stock_record10.*', 'stock_type.code as type_code', 'department.code as department_code', 'warehouse.code as warehouse_code']);
|
||||
|
||||
$rows = DB::table('stock_record10_data')
|
||||
->leftJoin('product', 'product.id', '=', 'stock_record10_data.product_id')
|
||||
->where('stock_record10_data.record10_id', $id)
|
||||
->get(['stock_record10_data.*', 'product.code as product_code']);
|
||||
// 同步数据到yonyou
|
||||
$ret = plugin_sync_api('postRecord10', ['master' => $master, 'rows' => $rows]);
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
abort_error($ret['msg']);
|
||||
}
|
||||
|
||||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_record10')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'Rdrecord10', 'field' => 'cCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在产成品入库单['.$master['sn'].']无法弃审。');
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterStore($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeDelete($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php namespace Gdoo\Stock\Hooks;
|
||||
|
||||
use DB;
|
||||
use Exception;
|
||||
|
||||
class Record11Hook
|
||||
{
|
||||
public function onBeforeForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterForm($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeStore($params) {
|
||||
$datas = $params['datas'];
|
||||
// 处理生产日期
|
||||
foreach($datas as $i => $data) {
|
||||
if ($data['table'] == 'stock_record11_data') {
|
||||
foreach($data['data'] as $j => $row) {
|
||||
if ($row['batch_sn']) {
|
||||
$batch_sn = substr($row['batch_sn'], 0, 6);
|
||||
$sn = str_split($batch_sn, 2);
|
||||
$row['batch_date'] = date("Y-m-d", mktime(0, 0, 0, $sn[1], $sn[2], $sn[0]));
|
||||
}
|
||||
$data['data'][$j] = $row;
|
||||
}
|
||||
$datas[$i] = $data;
|
||||
}
|
||||
}
|
||||
$params['datas'] = $datas;
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeAudit($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_record11')
|
||||
->leftJoin('warehouse', 'warehouse.id', '=', 'stock_record11.warehouse_id')
|
||||
->leftJoin('department', 'department.id', '=', 'stock_record11.department_id')
|
||||
->leftJoin('stock_type', 'stock_type.id', '=', 'stock_record11.category_id')
|
||||
->where('stock_record11.id', $id)
|
||||
->first(['stock_record11.*', 'stock_type.code as type_code', 'department.code as department_code', 'warehouse.code as warehouse_code']);
|
||||
|
||||
$rows = DB::table('stock_record11_data')
|
||||
->leftJoin('product', 'product.id', '=', 'stock_record11_data.product_id')
|
||||
->where('stock_record11_data.record11_id', $id)
|
||||
->get(['stock_record11_data.*', 'product.code as product_code']);
|
||||
// 同步数据到yonyou
|
||||
$ret = plugin_sync_api('postRecord11', ['master' => $master, 'rows' => $rows]);
|
||||
|
||||
if ($ret['success'] == true) {
|
||||
return $params;
|
||||
}
|
||||
abort_error($ret['msg']);
|
||||
}
|
||||
|
||||
public function onBeforeAbort($params) {
|
||||
$id = $params['id'];
|
||||
$master = DB::table('stock_record11')->where('id', $id)->first();
|
||||
// 检查用友单据是否存在
|
||||
$ret = plugin_sync_api('getVouchExist', ['table' => 'Rdrecord11', 'field' => 'cCode', 'value' => $master['sn']]);
|
||||
if ($ret['msg'] > 0) {
|
||||
abort_error('用友存在原材料出库单['.$master['sn'].']无法弃审。');
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onAfterStore($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function onBeforeDelete($params) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php namespace Gdoo\Stock\Models;
|
||||
|
||||
use DB;
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class Allocation extends BaseModel
|
||||
{
|
||||
protected $table = 'stock_allocation';
|
||||
|
||||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'allocation', 'url' => 'stock/allocation/index', 'name' => '产成品调拨单'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $bys = [
|
||||
'name' => 'by',
|
||||
'items' => [
|
||||
['value' => '', 'name' => '全部'],
|
||||
['value' => 'enabled', 'name' => '启用'],
|
||||
['value' => 'disabled', 'name' => '禁用'],
|
||||
['value' => 'divider'],
|
||||
['value' => 'day', 'name' => '今日创建'],
|
||||
['value' => 'week', 'name' => '本周创建'],
|
||||
['value' => 'month', 'name' => '本月创建'],
|
||||
]
|
||||
];
|
||||
|
||||
public function warehouse($query)
|
||||
{
|
||||
return $this->belongsTo('Gdoo\Stock\Models\Warehouse');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php namespace Gdoo\Stock\Models;
|
||||
|
||||
use DB;
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class Cancel extends BaseModel
|
||||
{
|
||||
protected $table = 'stock_cancel';
|
||||
|
||||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'cancel', 'url' => 'stock/cancel/index', 'name' => '退货申请'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $bys = [
|
||||
'name' => 'by',
|
||||
'items' => [
|
||||
['value' => '', 'name' => '全部'],
|
||||
['value' => 'enabled', 'name' => '启用'],
|
||||
['value' => 'disabled', 'name' => '禁用'],
|
||||
['value' => 'divider'],
|
||||
['value' => 'day', 'name' => '今日创建'],
|
||||
['value' => 'week', 'name' => '本周创建'],
|
||||
['value' => 'month', 'name' => '本月创建'],
|
||||
]
|
||||
];
|
||||
|
||||
public function warehouse($query)
|
||||
{
|
||||
return $this->belongsTo('Gdoo\Stock\Models\Warehouse');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php namespace Gdoo\Stock\Models;
|
||||
|
||||
use DB;
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class Delivery extends BaseModel
|
||||
{
|
||||
protected $table = 'stock_delivery';
|
||||
|
||||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'delivery', 'url' => 'stock/delivery/index', 'name' => '发货单'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $tabs2 = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'delivery', 'url' => 'stock/delivery/detail', 'name' => '发货明细'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $bys = [
|
||||
'name' => 'by',
|
||||
'items' => [
|
||||
['value' => '', 'name' => '全部'],
|
||||
['value' => 'enabled', 'name' => '启用'],
|
||||
['value' => 'disabled', 'name' => '禁用'],
|
||||
['value' => 'divider'],
|
||||
['value' => 'day', 'name' => '今日创建'],
|
||||
['value' => 'week', 'name' => '本周创建'],
|
||||
['value' => 'month', 'name' => '本月创建'],
|
||||
]
|
||||
];
|
||||
|
||||
public function warehouse($query)
|
||||
{
|
||||
return $this->belongsTo('Gdoo\Stock\Models\Warehouse');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php namespace Gdoo\Stock\Models;
|
||||
|
||||
use DB;
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class Direct extends BaseModel
|
||||
{
|
||||
protected $table = 'stock_direct';
|
||||
|
||||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'direct', 'url' => 'stock/direct/index', 'name' => '发货单(直营)'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $bys = [
|
||||
'name' => 'by',
|
||||
'items' => [
|
||||
['value' => '', 'name' => '全部'],
|
||||
['value' => 'enabled', 'name' => '启用'],
|
||||
['value' => 'disabled', 'name' => '禁用'],
|
||||
['value' => 'divider'],
|
||||
['value' => 'day', 'name' => '今日创建'],
|
||||
['value' => 'week', 'name' => '本周创建'],
|
||||
['value' => 'month', 'name' => '本月创建'],
|
||||
]
|
||||
];
|
||||
|
||||
public function warehouse($query)
|
||||
{
|
||||
return $this->belongsTo('Gdoo\Stock\Models\Warehouse');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php namespace Gdoo\Stock\Models;
|
||||
|
||||
use DB;
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class Record01 extends BaseModel
|
||||
{
|
||||
protected $table = 'stock_record01';
|
||||
|
||||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'record01', 'url' => 'stock/record01/index', 'name' => '采购入库单'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $bys = [
|
||||
'name' => 'by',
|
||||
'items' => [
|
||||
['value' => '', 'name' => '全部'],
|
||||
['value' => 'enabled', 'name' => '启用'],
|
||||
['value' => 'disabled', 'name' => '禁用'],
|
||||
['value' => 'divider'],
|
||||
['value' => 'day', 'name' => '今日创建'],
|
||||
['value' => 'week', 'name' => '本周创建'],
|
||||
['value' => 'month', 'name' => '本月创建'],
|
||||
]
|
||||
];
|
||||
|
||||
public function warehouse($query)
|
||||
{
|
||||
return $this->belongsTo('Gdoo\Stock\Models\Warehouse');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php namespace Gdoo\Stock\Models;
|
||||
|
||||
use DB;
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class Record08 extends BaseModel
|
||||
{
|
||||
protected $table = 'stock_record08';
|
||||
|
||||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'record08', 'url' => 'stock/record08/index', 'name' => '其他入库单'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $bys = [
|
||||
'name' => 'by',
|
||||
'items' => [
|
||||
['value' => '', 'name' => '全部'],
|
||||
['value' => 'enabled', 'name' => '启用'],
|
||||
['value' => 'disabled', 'name' => '禁用'],
|
||||
['value' => 'divider'],
|
||||
['value' => 'day', 'name' => '今日创建'],
|
||||
['value' => 'week', 'name' => '本周创建'],
|
||||
['value' => 'month', 'name' => '本月创建'],
|
||||
]
|
||||
];
|
||||
|
||||
public function warehouse($query)
|
||||
{
|
||||
return $this->belongsTo('Gdoo\Stock\Models\Warehouse');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php namespace Gdoo\Stock\Models;
|
||||
|
||||
use DB;
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class Record09 extends BaseModel
|
||||
{
|
||||
protected $table = 'stock_record09';
|
||||
|
||||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'record09', 'url' => 'stock/record09/index', 'name' => '其他出库单'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $bys = [
|
||||
'name' => 'by',
|
||||
'items' => [
|
||||
['value' => '', 'name' => '全部'],
|
||||
['value' => 'enabled', 'name' => '启用'],
|
||||
['value' => 'disabled', 'name' => '禁用'],
|
||||
['value' => 'divider'],
|
||||
['value' => 'day', 'name' => '今日创建'],
|
||||
['value' => 'week', 'name' => '本周创建'],
|
||||
['value' => 'month', 'name' => '本月创建'],
|
||||
]
|
||||
];
|
||||
|
||||
public function warehouse($query)
|
||||
{
|
||||
return $this->belongsTo('Gdoo\Stock\Models\Warehouse');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php namespace Gdoo\Stock\Models;
|
||||
|
||||
use DB;
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class Record10 extends BaseModel
|
||||
{
|
||||
protected $table = 'stock_record10';
|
||||
|
||||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'record10', 'url' => 'stock/record10/index', 'name' => '产成品入库单'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $bys = [
|
||||
'name' => 'by',
|
||||
'items' => [
|
||||
['value' => '', 'name' => '全部'],
|
||||
['value' => 'enabled', 'name' => '启用'],
|
||||
['value' => 'disabled', 'name' => '禁用'],
|
||||
['value' => 'divider'],
|
||||
['value' => 'day', 'name' => '今日创建'],
|
||||
['value' => 'week', 'name' => '本周创建'],
|
||||
['value' => 'month', 'name' => '本月创建'],
|
||||
]
|
||||
];
|
||||
|
||||
public function warehouse($query)
|
||||
{
|
||||
return $this->belongsTo('Gdoo\Stock\Models\Warehouse');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php namespace Gdoo\Stock\Models;
|
||||
|
||||
use DB;
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class Record11 extends BaseModel
|
||||
{
|
||||
protected $table = 'stock_record11';
|
||||
|
||||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'record11', 'url' => 'stock/record11/index', 'name' => '原材料出库单'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $bys = [
|
||||
'name' => 'by',
|
||||
'items' => [
|
||||
['value' => '', 'name' => '全部'],
|
||||
['value' => 'enabled', 'name' => '启用'],
|
||||
['value' => 'disabled', 'name' => '禁用'],
|
||||
['value' => 'divider'],
|
||||
['value' => 'day', 'name' => '今日创建'],
|
||||
['value' => 'week', 'name' => '本周创建'],
|
||||
['value' => 'month', 'name' => '本月创建'],
|
||||
]
|
||||
];
|
||||
|
||||
public function warehouse()
|
||||
{
|
||||
return $this->belongsTo('Gdoo\Stock\Models\Warehouse');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php namespace Gdoo\Stock\Models;
|
||||
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class StockCategory extends BaseModel
|
||||
{
|
||||
protected $table = 'stock_type';
|
||||
|
||||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'category', 'url' => 'stock/category/index', 'name' => '库存类别'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $bys = [
|
||||
'name' => 'by',
|
||||
'items' => [
|
||||
['value' => '', 'name' => '全部'],
|
||||
['value' => 'enabled', 'name' => '启用'],
|
||||
['value' => 'disabled', 'name' => '禁用'],
|
||||
['value' => 'divider'],
|
||||
['value' => 'day', 'name' => '今日创建'],
|
||||
['value' => 'week', 'name' => '本周创建'],
|
||||
['value' => 'month', 'name' => '本月创建'],
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php namespace Gdoo\Stock\Models;
|
||||
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class StockType extends BaseModel
|
||||
{
|
||||
protected $table = 'sale_type';
|
||||
|
||||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'type', 'url' => 'stock/type/index', 'name' => '销售类型'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $bys = [
|
||||
'name' => 'by',
|
||||
'items' => [
|
||||
['value' => '', 'name' => '全部'],
|
||||
['value' => 'enabled', 'name' => '启用'],
|
||||
['value' => 'disabled', 'name' => '禁用'],
|
||||
['value' => 'divider'],
|
||||
['value' => 'day', 'name' => '今日创建'],
|
||||
['value' => 'week', 'name' => '本周创建'],
|
||||
['value' => 'month', 'name' => '本月创建'],
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php namespace Gdoo\Stock\Models;
|
||||
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class Warehouse extends BaseModel
|
||||
{
|
||||
protected $table = 'warehouse';
|
||||
|
||||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'stock', 'url' => 'stock/warehouse/index', 'name' => '仓库档案'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $bys = [
|
||||
'name' => 'by',
|
||||
'items' => [
|
||||
['value' => '', 'name' => '全部'],
|
||||
['value' => 'divider'],
|
||||
['value' => 'day', 'name' => '今日创建'],
|
||||
['value' => 'week', 'name' => '本周创建'],
|
||||
['value' => 'month', 'name' => '本月创建'],
|
||||
]
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('Gdoo\User\Models\User');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php namespace Gdoo\Stock\Models;
|
||||
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class WarehouseLocation extends BaseModel
|
||||
{
|
||||
protected $table = 'warehouse_location';
|
||||
|
||||
public static $tabs = [
|
||||
'name' => 'tab',
|
||||
'items' => [
|
||||
['value' => 'location', 'url' => 'stock/location/index', 'name' => '仓库货位'],
|
||||
]
|
||||
];
|
||||
|
||||
public static $bys = [
|
||||
'name' => 'by',
|
||||
'items' => [
|
||||
['value' => '', 'name' => '全部'],
|
||||
['value' => 'divider'],
|
||||
['value' => 'day', 'name' => '今日创建'],
|
||||
['value' => 'week', 'name' => '本周创建'],
|
||||
['value' => 'month', 'name' => '本月创建'],
|
||||
]
|
||||
];
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,419 @@
|
||||
<?php
|
||||
return [
|
||||
"name" => "库存管理",
|
||||
"version" => "1.0",
|
||||
"description" => "产品列表,产品类别,库存类型,仓库类别,库存管理,仓库列表。",
|
||||
"listens" => [
|
||||
'stock_delivery' => 'Gdoo\Stock\Hooks\DeliveryHook',
|
||||
'stock_delivery_data' => 'Gdoo\Stock\Hooks\DeliveryDataHook',
|
||||
'stock_record11' => 'Gdoo\Stock\Hooks\Record11Hook',
|
||||
|
||||
'stock_record10' => 'Gdoo\Stock\Hooks\Record10Hook',
|
||||
'stock_record10_data' => 'Gdoo\Stock\Hooks\Record10DataHook',
|
||||
|
||||
'stock_record09' => 'Gdoo\Stock\Hooks\Record09Hook',
|
||||
'stock_record08' => 'Gdoo\Stock\Hooks\Record08Hook',
|
||||
'stock_record01' => 'Gdoo\Stock\Hooks\Record01Hook',
|
||||
'stock_direct' => 'Gdoo\Stock\Hooks\DirectHook',
|
||||
'stock_cancel' => 'Gdoo\Stock\Hooks\CancelHook',
|
||||
'stock_allocation' => 'Gdoo\Stock\Hooks\AllocationHook',
|
||||
],
|
||||
'dialogs' => [
|
||||
'warehouse' => [
|
||||
'name' => '仓库',
|
||||
'model' => 'Gdoo\Stock\Models\Warehouse::Dialog',
|
||||
'url' => 'stock/warehouse/dialog',
|
||||
],
|
||||
'location_batch' => [
|
||||
'name' => '库存数量',
|
||||
'model' => 'Gdoo\Stock\Models\WarehouseLocation::Dialog',
|
||||
'url' => 'stock/location/dialog2',
|
||||
],
|
||||
'warehouse_location' => [
|
||||
'name' => '仓库货位',
|
||||
'model' => 'Gdoo\Stock\Models\WarehouseLocation::Dialog',
|
||||
'url' => 'stock/location/dialog',
|
||||
],
|
||||
],
|
||||
"controllers" => [
|
||||
"delivery" => [
|
||||
"name" => "发货单",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表",
|
||||
],
|
||||
"detail" => [
|
||||
"name" => "明细列表",
|
||||
],
|
||||
"show" => [
|
||||
"name" => "查看"
|
||||
],
|
||||
"create" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"edit" => [
|
||||
"name" => "编辑"
|
||||
],
|
||||
"audit" => [
|
||||
"name" => "审核"
|
||||
],
|
||||
"recall" => [
|
||||
"name" => "撤回"
|
||||
],
|
||||
"abort" => [
|
||||
"name" => "弃审"
|
||||
],
|
||||
"print" => [
|
||||
"name" => "打印"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
],
|
||||
"batchEdit" => [
|
||||
"name" => "批量编辑"
|
||||
],
|
||||
]
|
||||
],
|
||||
"direct" => [
|
||||
"name" => "发货单(直营)",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表",
|
||||
],
|
||||
"show" => [
|
||||
"name" => "查看"
|
||||
],
|
||||
"create" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"edit" => [
|
||||
"name" => "编辑"
|
||||
],
|
||||
"audit" => [
|
||||
"name" => "审核"
|
||||
],
|
||||
"recall" => [
|
||||
"name" => "撤回"
|
||||
],
|
||||
"abort" => [
|
||||
"name" => "弃审"
|
||||
],
|
||||
"print" => [
|
||||
"name" => "打印"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
],
|
||||
]
|
||||
],
|
||||
"allocation" => [
|
||||
"name" => "产成品调拨单",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表",
|
||||
],
|
||||
"show" => [
|
||||
"name" => "查看"
|
||||
],
|
||||
"create" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"edit" => [
|
||||
"name" => "编辑"
|
||||
],
|
||||
"audit" => [
|
||||
"name" => "审核"
|
||||
],
|
||||
"recall" => [
|
||||
"name" => "撤回"
|
||||
],
|
||||
"abort" => [
|
||||
"name" => "弃审"
|
||||
],
|
||||
"print" => [
|
||||
"name" => "打印"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
],
|
||||
]
|
||||
],
|
||||
"cancel" => [
|
||||
"name" => "退货申请",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表",
|
||||
],
|
||||
"show" => [
|
||||
"name" => "查看"
|
||||
],
|
||||
"create" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"edit" => [
|
||||
"name" => "编辑"
|
||||
],
|
||||
"audit" => [
|
||||
"name" => "审核"
|
||||
],
|
||||
"recall" => [
|
||||
"name" => "撤回"
|
||||
],
|
||||
"abort" => [
|
||||
"name" => "弃审"
|
||||
],
|
||||
"print" => [
|
||||
"name" => "打印"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
],
|
||||
"batchEdit" => [
|
||||
"name" => "批量编辑"
|
||||
],
|
||||
]
|
||||
],
|
||||
"record01" => [
|
||||
"name" => "采购入库单",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表",
|
||||
],
|
||||
"show" => [
|
||||
"name" => "查看"
|
||||
],
|
||||
"create" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"edit" => [
|
||||
"name" => "编辑"
|
||||
],
|
||||
"audit" => [
|
||||
"name" => "审核"
|
||||
],
|
||||
"recall" => [
|
||||
"name" => "撤回"
|
||||
],
|
||||
"abort" => [
|
||||
"name" => "弃审"
|
||||
],
|
||||
"print" => [
|
||||
"name" => "打印"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
],
|
||||
]
|
||||
],
|
||||
"record10" => [
|
||||
"name" => "产成品入库单",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表",
|
||||
],
|
||||
"show" => [
|
||||
"name" => "查看"
|
||||
],
|
||||
"create" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"edit" => [
|
||||
"name" => "编辑"
|
||||
],
|
||||
"audit" => [
|
||||
"name" => "审核"
|
||||
],
|
||||
"recall" => [
|
||||
"name" => "撤回"
|
||||
],
|
||||
"abort" => [
|
||||
"name" => "弃审"
|
||||
],
|
||||
"print" => [
|
||||
"name" => "打印"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
],
|
||||
]
|
||||
],
|
||||
"record08" => [
|
||||
"name" => "其他入库单",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表",
|
||||
],
|
||||
"show" => [
|
||||
"name" => "查看"
|
||||
],
|
||||
"create" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"edit" => [
|
||||
"name" => "编辑"
|
||||
],
|
||||
"audit" => [
|
||||
"name" => "审核"
|
||||
],
|
||||
"recall" => [
|
||||
"name" => "撤回"
|
||||
],
|
||||
"abort" => [
|
||||
"name" => "弃审"
|
||||
],
|
||||
"print" => [
|
||||
"name" => "打印"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
],
|
||||
]
|
||||
],
|
||||
"record09" => [
|
||||
"name" => "其他出库单",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表",
|
||||
],
|
||||
"show" => [
|
||||
"name" => "查看"
|
||||
],
|
||||
"create" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"edit" => [
|
||||
"name" => "编辑"
|
||||
],
|
||||
"audit" => [
|
||||
"name" => "审核"
|
||||
],
|
||||
"recall" => [
|
||||
"name" => "撤回"
|
||||
],
|
||||
"abort" => [
|
||||
"name" => "弃审"
|
||||
],
|
||||
"print" => [
|
||||
"name" => "打印"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
],
|
||||
]
|
||||
],
|
||||
"record11" => [
|
||||
"name" => "原材料出库单",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表",
|
||||
],
|
||||
"show" => [
|
||||
"name" => "查看"
|
||||
],
|
||||
"create" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"edit" => [
|
||||
"name" => "编辑"
|
||||
],
|
||||
"audit" => [
|
||||
"name" => "审核"
|
||||
],
|
||||
"recall" => [
|
||||
"name" => "撤回"
|
||||
],
|
||||
"abort" => [
|
||||
"name" => "弃审"
|
||||
],
|
||||
"print" => [
|
||||
"name" => "打印"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
],
|
||||
]
|
||||
],
|
||||
"warehouse" => [
|
||||
"name" => "仓库档案",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表"
|
||||
],
|
||||
"create" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"edit" => [
|
||||
"name" => "编辑"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
]
|
||||
]
|
||||
],
|
||||
"location" => [
|
||||
"name" => "仓库货位",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表"
|
||||
],
|
||||
"create" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"edit" => [
|
||||
"name" => "编辑"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
]
|
||||
]
|
||||
],
|
||||
"type" => [
|
||||
"name" => "库存类型",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表"
|
||||
],
|
||||
"create" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"edit" => [
|
||||
"name" => "编辑"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
]
|
||||
]
|
||||
],
|
||||
"category" => [
|
||||
"name" => "库存类别",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表"
|
||||
],
|
||||
"create" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"edit" => [
|
||||
"name" => "编辑"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
]
|
||||
]
|
||||
],
|
||||
"report" => [
|
||||
"name" => "报表",
|
||||
"actions" => [
|
||||
"stockDetail" => [
|
||||
"name" => "库存明细表"
|
||||
],
|
||||
"stockTotal" => [
|
||||
"name" => "库存汇总表"
|
||||
],
|
||||
"stockInOut" => [
|
||||
"name" => "进销存汇总表"
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,451 @@
|
||||
<div class="form-panel">
|
||||
<div class="form-panel-header">
|
||||
<div class="pull-right">
|
||||
</div>
|
||||
{{$form['btn']}}
|
||||
|
||||
@if($form['action'] == 'show')
|
||||
@else
|
||||
<a href="javascript:orderDialog();" class="btn btn-sm btn-default">
|
||||
参照客户订单
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if($form['row']['id'] > 0)
|
||||
<a href="javascript:logisticsDialog();" class="btn btn-sm btn-default">
|
||||
物流信息
|
||||
</a>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
<div class="form-panel-body panel-form-{{$form['action']}}">
|
||||
<form class="form-horizontal form-controller" method="post" id="{{$form['table']}}" name="{{$form['table']}}">
|
||||
{{$form['tpl']}}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var table = '{{$form["table"]}}';
|
||||
var rowId = '{{$form["row"]["id"]}}';
|
||||
var action = '{{$form["action"]}}';
|
||||
var grid = null;
|
||||
|
||||
(function ($) {
|
||||
|
||||
var in_poscode = {};
|
||||
|
||||
if(action == 'show') {
|
||||
}
|
||||
else {
|
||||
$('#stock_allocation_data_tool').append('<a class="btn btn-sm btn-default" href="javascript:stockSelect();">选择库存</a>');
|
||||
}
|
||||
|
||||
// 获取生产批号
|
||||
function getBatchSelect(warehouse_id, product_id, batchs, fun) {
|
||||
$.post(app.url('stock/delivery/getBatchSelectZY'), {
|
||||
warehouse_id: warehouse_id,
|
||||
product_id: product_id,
|
||||
value: batchs
|
||||
}, function(res) {
|
||||
fun(res);
|
||||
});
|
||||
}
|
||||
|
||||
// 选择库存
|
||||
function stockSelect() {
|
||||
if (has_out_warehouse_id() == false) {
|
||||
return;
|
||||
}
|
||||
var buttons = [{
|
||||
text: "取消",
|
||||
'class': "btn-default",
|
||||
click: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}];
|
||||
buttons.push({
|
||||
text: '提交',
|
||||
'class': 'btn-info',
|
||||
click: function () {
|
||||
var rows = $ref_stock_select.getSelectedRows();
|
||||
stockRowsSelected(rows);
|
||||
$(this).dialog('close');
|
||||
}
|
||||
});
|
||||
var warehouse_id = get_out_warehouse_id();
|
||||
$.dialog({
|
||||
title: '选择库存',
|
||||
url: '{{url("stock/allocation/stockSelect")}}?warehouse_id=' + warehouse_id,
|
||||
dialogClass: 'modal-lg',
|
||||
buttons: buttons
|
||||
});
|
||||
}
|
||||
window.stockSelect = stockSelect;
|
||||
|
||||
// 库存写入
|
||||
var stockRowsSelected = function(rows) {
|
||||
if (rows.length == 0) {
|
||||
return;
|
||||
}
|
||||
grid.api.forEachNode(function (node) {
|
||||
var data = node.data;
|
||||
if (isEmpty(data.product_id)) {
|
||||
grid.api.updateRowData({remove:[data]});
|
||||
}
|
||||
});
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
row.quantity = parseFloat(row.ky_num);
|
||||
row.out_poscode = row.poscode;
|
||||
row.out_posname = row.posname;
|
||||
|
||||
row.in_poscode = in_poscode.code;
|
||||
row.in_posname = in_poscode.name;
|
||||
|
||||
grid.api.memoryStore.create(row);
|
||||
}
|
||||
grid.generatePinnedBottomData();
|
||||
return true;
|
||||
};
|
||||
window.stockRowsSelected = stockRowsSelected;
|
||||
|
||||
var orderDialog = function () {
|
||||
var buttons = [{
|
||||
text: "取消",
|
||||
'class': "btn-default",
|
||||
click: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}];
|
||||
buttons.push({
|
||||
text: '提交',
|
||||
'class': 'btn-info',
|
||||
click: function () {
|
||||
var me = this;
|
||||
var orders = $ref_customer_order.api.getSelectedRows();
|
||||
if (orders.length > 0) {
|
||||
|
||||
var has = {};
|
||||
for (var i = 0; i < orders.length; i++) {
|
||||
has[orders[i].tax_id] = 1;
|
||||
}
|
||||
if (Object.keys(has).length > 1) {
|
||||
$.messager.alert('操作警告', '参照订单开票单位必须一致。');
|
||||
return;
|
||||
}
|
||||
|
||||
var master = orders[0];
|
||||
|
||||
grid.api.forEachNode(function (node) {
|
||||
var data = node.data;
|
||||
if (isEmpty(data.product_id)) {
|
||||
grid.api.updateRowData({remove:[data]});
|
||||
}
|
||||
});
|
||||
|
||||
// 合并商品
|
||||
var products = {};
|
||||
var batchs = {};
|
||||
var rows = $ref_customer_order_data.api.getSelectedRows();
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
// 跳过费用
|
||||
if (row.product_code == '99001') {
|
||||
continue;
|
||||
}
|
||||
var product = parseFloat(products[row.product_id]);
|
||||
if (isNaN(product)) {
|
||||
products[row.product_id] = 0;
|
||||
}
|
||||
|
||||
if (!isEmpty(row.batch_sn)) {
|
||||
batchs[row.batch_sn] = row.batch_sn;
|
||||
}
|
||||
products[row.product_id] += parseFloat(row.wf_num);
|
||||
}
|
||||
|
||||
var loading = layer.msg('数据提交中...', {
|
||||
icon: 16, shade: 0.1, time: 1000 * 120
|
||||
});
|
||||
|
||||
var product_ids = Object.keys(products).join(',');
|
||||
var batch_ids = Object.keys(batchs).join(',');
|
||||
if (batch_ids == 'null') {
|
||||
batch_ids = '';
|
||||
}
|
||||
|
||||
var warehouse_id = get_out_warehouse_id();
|
||||
getBatchSelect(warehouse_id, product_ids, batch_ids, function(res) {
|
||||
var batch_list = {};
|
||||
for (let k = 0; k < res.data.length; k++) {
|
||||
var row = res.data[k];
|
||||
if (batch_list[row.product_id] == undefined) {
|
||||
batch_list[row.product_id] = [];
|
||||
}
|
||||
batch_list[row.product_id].push(row);
|
||||
}
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
var quantity = parseFloat(row.wf_num);
|
||||
// 折扣额使用
|
||||
if (row.product_code == '99001') {
|
||||
row.quantity = '';
|
||||
grid.api.memoryStore.create(row);
|
||||
} else {
|
||||
// 产品库存不足
|
||||
if (row.ky_num <= 0) {
|
||||
continue;
|
||||
}
|
||||
var ret = false;
|
||||
|
||||
var _batchs = batch_list[row.product_id];
|
||||
if(_batchs == undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (var j = 0; j < _batchs.length; j++) {
|
||||
var batch = _batchs[j];
|
||||
var ky_num = parseFloat(batch.ky_num);
|
||||
if (ky_num <= 0) {
|
||||
continue;
|
||||
}
|
||||
var item = jQuery.extend({}, row);
|
||||
if (quantity > ky_num) {
|
||||
item.quantity = ky_num;
|
||||
quantity = quantity - ky_num;
|
||||
} else {
|
||||
ret = true;
|
||||
item.quantity = quantity;
|
||||
}
|
||||
// 减少批号可用量
|
||||
batch.ky_num = ky_num - item.quantity;
|
||||
|
||||
item.warehouse_id = batch.warehouse_id;
|
||||
item.warehouse_id_name = batch.warehouse_name;
|
||||
item.batch_sn = batch.batch_sn;
|
||||
item.batch_date = batch.batch_date;
|
||||
|
||||
item.out_poscode = batch.poscode;
|
||||
item.out_posname = batch.posname;
|
||||
|
||||
row.in_poscode = in_poscode.code;
|
||||
row.in_posname = in_poscode.name;
|
||||
|
||||
item.total_weight = item.quantity * item.weight;
|
||||
item.money = item.quantity * item.price;
|
||||
// 赠品
|
||||
if (item.type_id == 2) {
|
||||
item.other_money = item.money;
|
||||
}
|
||||
grid.api.memoryStore.create(item);
|
||||
// 单个产品写入结束
|
||||
if (ret == true) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#stock_allocation_invoice_dt').val(master.plan_delivery_dt);
|
||||
$('#stock_allocation_delivery_dt').val(master.plan_delivery_dt);
|
||||
$('#stock_allocation_remark').val(master.remark);
|
||||
|
||||
layer.close(loading);
|
||||
grid.generatePinnedBottomData();
|
||||
$(me).dialog('close');
|
||||
});
|
||||
|
||||
} else {
|
||||
toastrError('销售订单必须选择。');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (has_out_warehouse_id() == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.dialog({
|
||||
title: '客户订单',
|
||||
url: '{{url("order/order/serviceDelivery")}}?is_direct=1',
|
||||
dialogClass: 'modal-lg',
|
||||
buttons: buttons
|
||||
});
|
||||
}
|
||||
window.orderDialog = orderDialog;
|
||||
|
||||
var logisticsDialog = function () {
|
||||
formDialog({
|
||||
title: '物流信息',
|
||||
url: app.url('stock/allocation/logistics', {id: rowId}),
|
||||
storeUrl: app.url('stock/allocation/logistics'),
|
||||
id: 'allocation_logistics',
|
||||
dialogClass:'modal-md',
|
||||
success: function(res) {
|
||||
toastrSuccess(res.data);
|
||||
grid.remoteData();
|
||||
$(this).dialog("close");
|
||||
},
|
||||
error: function(res) {
|
||||
toastrError(res.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
window.logisticsDialog = logisticsDialog;
|
||||
|
||||
// grid初始化事件
|
||||
gdoo.event.set('grid.stock_allocation_data', {
|
||||
ready(me) {
|
||||
grid = me;
|
||||
grid.dataKey = 'product_id';
|
||||
},
|
||||
editable: {
|
||||
batch_sn(params) {
|
||||
var row = params.data;
|
||||
if (row.product_id > 0) {
|
||||
} else {
|
||||
toastrError('请先选择产品');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
out_poscode(params) {
|
||||
return has_out_warehouse_id();
|
||||
},
|
||||
in_poscode(params) {
|
||||
return has_in_warehouse_id();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 选择生产批号
|
||||
gdoo.event.set('stock_allocation_data.batch_sn', {
|
||||
open(params) {
|
||||
params.title = '选择库存现存量';
|
||||
params.url = 'stock/delivery/getBatchSelectZY';
|
||||
},
|
||||
query(query) {
|
||||
query.warehouse_id = get_out_warehouse_id();
|
||||
var row = grid.lastEditCell.data;
|
||||
if (row.product_id > 0) {
|
||||
query.product_id = row.product_id;
|
||||
}
|
||||
},
|
||||
onSelect(row, batch) {
|
||||
var quantity = parseFloat(row.quantity);
|
||||
var ky_num = parseFloat(batch.ky_num);
|
||||
quantity = quantity - ky_num;
|
||||
if (quantity > 0) {
|
||||
row.quantity = ky_num;
|
||||
}
|
||||
|
||||
row.batch_sn = batch.batch_sn;
|
||||
row.batch_date = batch.batch_date;
|
||||
|
||||
row.out_poscode = batch.poscode;
|
||||
row.out_posname = batch.posname;
|
||||
|
||||
row.in_poscode = in_poscode.code;
|
||||
row.in_posname = in_poscode.name;
|
||||
|
||||
// 库存现存量不足写入剩余数量
|
||||
if (quantity > 0) {
|
||||
var item = jQuery.extend({}, row);
|
||||
item.quantity = quantity;
|
||||
|
||||
item.batch_sn = '';
|
||||
item.batch_date = '';
|
||||
|
||||
item.in_poscode = '';
|
||||
item.in_posname = '';
|
||||
|
||||
item.out_poscode = '';
|
||||
item.out_posname = '';
|
||||
|
||||
grid.api.memoryStore.create(item);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 选择转出货位编号
|
||||
gdoo.event.set('stock_allocation_data.out_poscode', {
|
||||
query(query) {
|
||||
var warehouse_id = get_out_warehouse_id();
|
||||
if (warehouse_id > 0) {
|
||||
query.warehouse_id = warehouse_id;
|
||||
}
|
||||
},
|
||||
onSelect(row, selectedRow) {
|
||||
row.out_poscode = selectedRow.code;
|
||||
row.out_posname = selectedRow.name;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 选择转入货位编号
|
||||
gdoo.event.set('stock_allocation_data.in_poscode', {
|
||||
query(query) {
|
||||
var warehouse_id = get_in_warehouse_id();
|
||||
if (warehouse_id > 0) {
|
||||
query.warehouse_id = warehouse_id;
|
||||
}
|
||||
},
|
||||
onSelect(row, selectedRow) {
|
||||
row.in_poscode = selectedRow.code;
|
||||
row.in_posname = selectedRow.name;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
function get_out_warehouse_id() {
|
||||
var warehouse_id = $('#stock_allocation_out_warehouse_id').val();
|
||||
return warehouse_id || 0;
|
||||
}
|
||||
|
||||
function get_in_warehouse_id() {
|
||||
var warehouse_id = $('#stock_allocation_in_warehouse_id').val();
|
||||
return warehouse_id || 0;
|
||||
}
|
||||
|
||||
function has_out_warehouse_id() {
|
||||
var warehouse_id = get_out_warehouse_id();
|
||||
if (warehouse_id == 0) {
|
||||
toastrError('请先选择转出仓库');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function has_in_warehouse_id() {
|
||||
var warehouse_id = get_in_warehouse_id();
|
||||
if (warehouse_id == 0) {
|
||||
toastrError('请先选择转入仓库');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function get_warehouse_in_poscode() {
|
||||
var warehouse_id = get_in_warehouse_id();
|
||||
$.post(app.url('stock/location/dialog'), {warehouse_id: warehouse_id}, function (res) {
|
||||
if (res.data.length > 0) {
|
||||
in_poscode = res.data[0];
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
$('#stock_allocation_in_warehouse_id').on('change', function() {
|
||||
get_warehouse_in_poscode();
|
||||
});
|
||||
|
||||
get_warehouse_in_poscode();
|
||||
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,60 @@
|
||||
{{$header["js"]}}
|
||||
|
||||
<div class="panel no-border" id="{{$header['master_table']}}-controller">
|
||||
@include('headers')
|
||||
<div class='list-jqgrid'>
|
||||
<div id="{{$header['master_table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
var table = '{{$header["master_table"]}}';
|
||||
var config = gdoo.grids[table];
|
||||
var action = config.action;
|
||||
var search = config.search;
|
||||
|
||||
action.dialogType = 'layer';
|
||||
|
||||
// 自定义搜索方法
|
||||
search.searchInit = function (e) {
|
||||
var self = this;
|
||||
}
|
||||
|
||||
var options = new agGridOptions();
|
||||
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
|
||||
gridDiv.style.height = getPanelHeight(48);
|
||||
|
||||
options.remoteDataUrl = '{{url()}}';
|
||||
options.remoteParams = search.advanced.query;
|
||||
options.columnDefs = config.cols;
|
||||
options.autoColumnsToFit = false;
|
||||
options.onRowDoubleClicked = function (params) {
|
||||
if (params.node.rowPinned) {
|
||||
return;
|
||||
}
|
||||
if (params.data == undefined) {
|
||||
return;
|
||||
}
|
||||
if (params.data.master_id > 0) {
|
||||
action.show(params.data);
|
||||
}
|
||||
};
|
||||
|
||||
new agGrid.Grid(gridDiv, options);
|
||||
|
||||
// 读取数据
|
||||
options.remoteData({page: 1});
|
||||
|
||||
// 绑定自定义事件
|
||||
var $gridDiv = $(gridDiv);
|
||||
$gridDiv.on('click', '[data-toggle="event"]', function () {
|
||||
var data = $(this).data();
|
||||
if (data.master_id > 0) {
|
||||
action[data.action](data);
|
||||
}
|
||||
});
|
||||
config.grid = options;
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@include('footers')
|
||||
@@ -0,0 +1,105 @@
|
||||
<style>
|
||||
#allocation_logistics {
|
||||
padding: 0;
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
#allocation_logistics .form-group:first-child > div {
|
||||
border: 0;
|
||||
}
|
||||
#allocation_logistics .control-label {
|
||||
padding: 5px;
|
||||
padding-top: 11px;
|
||||
display: block;
|
||||
font-weight: 400;
|
||||
}
|
||||
#allocation_logistics .control-text {
|
||||
padding: 5px;
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<form class="form-horizontal form-controller" method="post" id="allocation_logistics" name="allocation_logistics">
|
||||
|
||||
<group>
|
||||
<field name="freight_quantity" options="{'col_name':4}" label="1" col_name=4 col_label=2 col_type=xs />
|
||||
<field name=freight_weight label=1 col_name=4 col_label=2 col_type=xs />
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<field name=freight_part_quantity label=1 col_name=4 col_label=2 col_type=xs />
|
||||
<field name=freight_part_weight label=1 col_name=4 col_label=2 col_type=xs />
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<field name=freight_short_logistics_id label=1 col_name=4 col_label=2 col_type=xs />
|
||||
<field name=freight_short_car label=1 col_name=4 col_label=2 col_type=xs />
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<field name=freight_short_start label=1 col_name=4 col_label=2 col_type=xs />
|
||||
<field name=freight_short_end label=1 col_name=4 col_label=2 col_type=xs />
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<field name=freight_price label=1 col_name=4 col_label=2 col_type=xs />
|
||||
<field name=freight_short_money label=1 col_name=4 col_label=2 col_type=xs />
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<field name=freight_logistics_id label=1 col_name=4 col_label=2 col_type=xs />
|
||||
<field name=freight_logistics_phone label=1 col_name=4 col_label=2 col_type=xs />
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<field name=freight_type label=1 col_name=4 col_label=2 col_type=xs />
|
||||
<field name=freight_sn label=1 col_name=4 col_label=2 col_type=xs />
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<field name=freight_money label=1 col_name=4 col_label=2 col_type=xs />
|
||||
<field name=freight_customer_money label=1 col_name=4 col_label=2 col_type=xs />
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<field name=freight_self_money read=1 label=1 col_name=4 col_label=2 col_type=xs />
|
||||
<field name=freight_pay_type label=1 col_name=4 col_label=2 col_type=xs />
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<field name=freight_arrival_date label=1 col_name=4 col_label=2 col_type=xs />
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<field name=freight_remark label=1 col_name=10 col_label=2 col_type=xs />
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<field name=freight_created_by read=1 label=1 col_name=4 col_label=2 col_type=xs />
|
||||
<field name=freight_created_dt read=1 label=1 col_name=4 col_label=2 col_type=xs />
|
||||
</group>
|
||||
|
||||
<field name=id hidden=1 />
|
||||
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$(function($) {
|
||||
$('#stock_allocation_freight_weight,#stock_allocation_freight_part_weight,#stock_allocation_freight_price').on('change', function(e) {
|
||||
var a = toNumber($('#stock_allocation_freight_weight').val());
|
||||
var b = toNumber($('#stock_allocation_freight_part_weight').val());
|
||||
var c = toNumber($('#stock_allocation_freight_price').val());
|
||||
var d = (a + b) * c;
|
||||
$('#stock_allocation_freight_short_money').val(d);
|
||||
});
|
||||
$('#stock_allocation_freight_money,#stock_allocation_freight_customer_money').on('change', function(e) {
|
||||
var a = toNumber($('#stock_allocation_freight_money').val());
|
||||
var b = toNumber($('#stock_allocation_freight_customer_money').val());
|
||||
var c = a - b;
|
||||
if (b > a) {
|
||||
c = 0;
|
||||
}
|
||||
$('#stock_allocation_freight_self_money').val(c);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1 @@
|
||||
{{$form['tpl']}}
|
||||
@@ -0,0 +1,108 @@
|
||||
<div id="div1">
|
||||
<div style="line-height:40px;font-size:14pt;" align=center><strong><font>{{$setting['print_title']}}产成品调拨单</font></strong></div>
|
||||
<table border=0 cellspacing=0 cellpadding=0 width="100%" style="font-size:11pt;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="40%"><font>单据编号:<span>{{$master['sn']}}</span></font></td>
|
||||
<td width="30%"><font>调拨日期:<span>{{$master['invoice_dt']}}</span></font></td>
|
||||
<td><font>转出仓库:<span>{{$master['out_warehouse_name']}}</span></font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><font>转入仓库:<span>{{$master['in_warehouse_name']}}</span></font></td>
|
||||
<td colspan="2"><font>备注:<span>{{$master['remark']}}</span></font></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="div2">
|
||||
<style>td { padding: 2px; }</style>
|
||||
<table style="font-size:11pt;border-width:1px;border-style:solid;border-collapse:collapse;" border="1" width="100%" cellspacing="0" cellpadding="0" style="border-collapse:collapse" bordercolor="#000000">
|
||||
<tr>
|
||||
<td align="center">产品编码</td>
|
||||
<td align="center">产品名称</td>
|
||||
<td align="center">规格型号</td>
|
||||
<td align="center">单位</td>
|
||||
<td align="center">数量</td>
|
||||
<td align="center">批号</td>
|
||||
<td align="center">货位</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@foreach($rows as $row)
|
||||
<tr>
|
||||
<td align="center">{{$row['product_code']}}</td>
|
||||
<td align="center">{{$row['product_name']}}</td>
|
||||
<td align="center">{{$row['product_spec']}}</td>
|
||||
<td align="center">{{$row['product_unit']}}</td>
|
||||
<td align="right">@number($row['quantity'], 2)</td>
|
||||
<td align="center">{{$row['batch_sn']}}</td>
|
||||
<td align="center">{{$row['posname']}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
<tfoot>
|
||||
<td align="center">合计</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td tdata="Sum" format="#,##0.00" align="right"><font id="id01">###</font></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tfoot>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="div3">
|
||||
<table width="100%" style="LINE-HEIGHT:30px;font-size:11pt;" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
|
||||
<tr>
|
||||
<td width="40%">制单人:{{$master['created_by']}}</td>
|
||||
<td width="40%">库管员:{{$warehouse_by}}</td>
|
||||
<td width="20%" align="right">第<font tdata="PageNO">##</font>页,<font tdata="PageCount">##</font></span>页</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="{{$asset_url}}/vendor/LodopFuncs.js"></script>
|
||||
<script type="text/javascript">
|
||||
var LODOP;
|
||||
function print280() {
|
||||
LODOP = getLodop();
|
||||
LODOP.PRINT_INIT("{{$form['template']['name']}}");
|
||||
LODOP.SET_PRINT_PAGESIZE(0, 2100, 2700, "CreateCustomPage");
|
||||
LODOP.ADD_PRINT_TABLE(90, "4%", "92%", 460, document.getElementById("div2").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"Vorient", 3);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, "4%", "92%", 115, document.getElementById("div1").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(555, "4%","92%", 54, document.getElementById("div3").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0,"LinkedItem", 1);
|
||||
LODOP.PREVIEW();
|
||||
};
|
||||
function print93() {
|
||||
LODOP = getLodop();
|
||||
|
||||
LODOP.PRINT_INIT("{{$form['template']['name']}}");
|
||||
|
||||
LODOP.SET_PRINT_PAGESIZE(0, 2100, 930, "CreateCustomPage");
|
||||
|
||||
LODOP.ADD_PRINT_TABLE(85, "4%", "92%", 465, document.getElementById("div2").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"Vorient", 3);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, "4%", "92%", 115, document.getElementById("div1").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(550, "4%","92%", 54, document.getElementById("div3").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0,"LinkedItem", 1);
|
||||
|
||||
LODOP.PREVIEW();
|
||||
};
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,127 @@
|
||||
<div id="div1">
|
||||
<div style="line-height:40px;font-size:14pt;" align=center><strong><font>{{$setting['print_title']}}产成品调拨单</font></strong></div>
|
||||
<table border=0 cellspacing=0 cellpadding=0 width="100%" style="font-size:11pt;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="43%"><font>单据编号:<span>{{$master['sn']}}</span></font></td>
|
||||
<td width="33%"><font>单据日期:<span>{{$master['invoice_dt']}}</span></font></td>
|
||||
<td><font>发货日期:{{$master['delivery_dt']}}</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><font>转入仓库:<span>{{$master['in_warehouse_name']}}</span></font></td>
|
||||
<td><font>转出仓库:<span>{{$master['out_warehouse_name']}}</span></font></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><font>备注:<span>{{$master['remark']}}</span></font></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="div2">
|
||||
<style>
|
||||
td { padding: 5px; }
|
||||
</style>
|
||||
<table style="font-size:11pt;border-width:1px;border-style:solid;border-collapse:collapse;" border="1" width="100%" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td align="center">产品编码</td>
|
||||
<td align="center">产品名称</td>
|
||||
<td align="center">规格型号</td>
|
||||
<td align="center">单位</td>
|
||||
<td align="center">数量</td>
|
||||
<td align="center">批号</td>
|
||||
<td align="center">货位</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@foreach($rows as $row)
|
||||
<tr>
|
||||
<td align="center">{{$row['product_code']}}</td>
|
||||
<td align="center">{{$row['product_name']}}</td>
|
||||
<td align="center">{{$row['product_spec']}}</td>
|
||||
<td align="center">{{$row['product_unit']}}</td>
|
||||
<td align="right"><strong style="font-size:18px;">@number($row['quantity'], 2)</strong></td>
|
||||
<td align="center"><strong style="font-size:18px;">{{$row['batch_sn']}}</strong></td>
|
||||
<td align="center">{{$row['posname']}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
<tfoot>
|
||||
<td align="center">合计</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td tdata="Sum" format="#,##0.00" align="right"><font id="id01">###</font></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tfoot>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="div4">
|
||||
<table width="100%" border="0" style="border:0;" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="25%">制单人:{{$master['created_by']}}</td>
|
||||
<td width="25%">会计:李彩</td>
|
||||
<td width="25%">发货:</td>
|
||||
<td width="25%">仓管:</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="div3">
|
||||
<table width="100%" style="LINE-HEIGHT:30px;font-size:11pt;" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
|
||||
<tr>
|
||||
<td width="100%" align="center">第<font tdata="PageNO">##</font>页,<font tdata="PageCount">##</font></span>页</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="{{$asset_url}}/vendor/LodopFuncs.js"></script>
|
||||
<script type="text/javascript">
|
||||
var LODOP;
|
||||
function print280() {
|
||||
LODOP = getLodop();
|
||||
LODOP.PRINT_INIT("{{$form['template']['name']}}");
|
||||
LODOP.SET_PRINT_PAGESIZE(0, 2100, 2700, "CreateCustomPage");
|
||||
var strStyle = "<style> table,td,th {border-width:1px;border-style:solid;border-collapse:collapse}</style>"
|
||||
LODOP.ADD_PRINT_TABLE(105, "4%", "92%", 430, document.getElementById("div2").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"Vorient", 3);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, "4%", "92%", 115, document.getElementById("div1").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, "4%","92%", 54, document.getElementById("div4").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"LinkedItem", 1);
|
||||
|
||||
LODOP.ADD_PRINT_HTM('96%', "4%", "92%", 54, document.getElementById("div3").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"ItemType", 1);
|
||||
|
||||
LODOP.PREVIEW();
|
||||
};
|
||||
function print140() {
|
||||
LODOP = getLodop();
|
||||
LODOP.PRINT_INIT("{{$form['template']['name']}}");
|
||||
LODOP.SET_PRINT_PAGESIZE(0, 2100, 1400, "CreateCustomPage");
|
||||
LODOP.ADD_PRINT_TABLE(105, "4%", "92%", 440, document.getElementById("div2").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"Vorient", 3);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, "4%", "92%", 115, document.getElementById("div1").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, "4%","92%", 54, document.getElementById("div4").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"LinkedItem", 1);
|
||||
|
||||
LODOP.ADD_PRINT_HTM('92%', "4%","92%", 54, document.getElementById("div3").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"ItemType", 1);
|
||||
|
||||
LODOP.PREVIEW();
|
||||
};
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,109 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<div class="wrapper-sm" style="padding-bottom:0;">
|
||||
<div id="dialog-promotion-toolbar">
|
||||
<form id="dialog-promotion-search-form" name="dialog_promotion_search_form" class="search-inline-form form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_promotion" class="ag-theme-balham" style="width:100%;height:140px;"></div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_promotion_data" class="ag-theme-balham" style="width:100%;height:240px;"></div>
|
||||
</div>
|
||||
<script>
|
||||
var $ref_promotion = null;
|
||||
var $ref_promotion_data = null;
|
||||
var params = JSON.parse('{{json_encode($query)}}');
|
||||
(function($) {
|
||||
params['master'] = 1;
|
||||
var mGridDiv = document.querySelector("#ref_promotion");
|
||||
var mGrid = new agGridOptions();
|
||||
mGrid.remoteDataUrl = '{{url()}}';
|
||||
mGrid.remoteParams = params;
|
||||
//mGrid.rowMultiSelectWithClick = true;
|
||||
mGrid.rowSelection = 'multiple';
|
||||
mGrid.autoColumnsToFit = false;
|
||||
mGrid.defaultColDef.suppressMenu = true;
|
||||
mGrid.defaultColDef.sortable = false;
|
||||
mGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'sn', headerName: '促销编号', minWidth: 160},
|
||||
{cellClass:'text-center', field: 'created_at', type: 'datetime', headerName: '单据日期', width: 120},
|
||||
{cellClass:'text-center', field: 'status', headerName: '状态', width: 160},
|
||||
{cellClass:'text-center', field: 'customer_code', headerName: '客户编码', width: 160},
|
||||
{field:'customer_name', headerName: '客户名称', width: 160},
|
||||
{field:'warehouse_contact', headerName: '收货人', width: 160},
|
||||
{field:'warehouse_phone', headerName: '收货人电话', width: 160},
|
||||
{field:'warehouse_address', headerName: '收货地址', width: 260},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
mGrid.onSelectionChanged = function() {
|
||||
var rows = mGrid.api.getSelectedRows();
|
||||
var ids = [];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
ids.push(rows[i].id);
|
||||
}
|
||||
params.promotion_ids = ids;
|
||||
sGrid.remoteData(params);
|
||||
};
|
||||
new agGrid.Grid(mGridDiv, mGrid);
|
||||
// 读取数据
|
||||
mGrid.remoteData();
|
||||
$ref_promotion = mGrid;
|
||||
|
||||
params['master'] = 0;
|
||||
var sGridDiv = document.querySelector("#ref_promotion_data");
|
||||
var sGrid = new agGridOptions();
|
||||
sGrid.remoteDataUrl = '{{url()}}';
|
||||
sGrid.remoteParams = params;
|
||||
//sGrid.rowMultiSelectWithClick = true;
|
||||
sGrid.rowSelection = 'multiple';
|
||||
sGrid.autoColumnsToFit = false;
|
||||
sGrid.defaultColDef.suppressMenu = true;
|
||||
sGrid.defaultColDef.sortable = false;
|
||||
sGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'product_code', headerName: '存货编码', width: 100},
|
||||
{field: 'product_name', headerName: '商品名称', minWidth: 180},
|
||||
{cellClass:'text-center', field: 'product_spec', headerName: '商品规格', width: 140},
|
||||
{cellClass:'text-center', field: 'unit_name', headerName: '计量单位', width: 80},
|
||||
{cellClass:'text-center', field: 'discount_rate', headerName: '现存量', width: 80},
|
||||
{cellClass:'text-right', field: 'total_quantity', headerName: '促销数量', width: 80},
|
||||
{cellClass:'text-right', field: 'use_quantity', headerName: '已发数量', width: 80},
|
||||
{cellClass:'text-right', field: 'quantity', headerName: '可用数量', width: 80},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
new agGrid.Grid(sGridDiv, sGrid);
|
||||
// 读取数据
|
||||
sGrid.remoteData();
|
||||
$ref_promotion_data = sGrid;
|
||||
|
||||
var data = JSON.parse('{{json_encode($search["forms"])}}');
|
||||
var search = $('#dialog-promotion-search-form').searchForm({
|
||||
data: data,
|
||||
init:function(e) {}
|
||||
});
|
||||
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var query = search.serializeArray();
|
||||
$.map(query, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
|
||||
params['master'] = 1;
|
||||
mGrid.remoteData(params);
|
||||
|
||||
params['master'] = 0;
|
||||
sGrid.remoteData(params);
|
||||
return false;
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,81 @@
|
||||
<div class="wrapper-xs">
|
||||
<form id="dialog-stock_select-search-form" class="form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="dialog-stock_select" class="ag-theme-balham" style="width:100%;height:380px;"></div>
|
||||
<script>
|
||||
var $ref_stock_select = null;
|
||||
(function ($) {
|
||||
var search = JSON.parse('{{json_encode($search)}}');
|
||||
var params = search.query;
|
||||
var gridDiv = document.querySelector("#dialog-stock_select");
|
||||
var grid = new agGridOptions();
|
||||
var multiple = true;
|
||||
grid.remoteDataUrl = '{{url()}}';
|
||||
grid.remoteParams = params;
|
||||
grid.suppressRowClickSelection = true;
|
||||
grid.rowSelection = multiple ? 'multiple' : 'single';
|
||||
grid.columnDefs = [
|
||||
{suppressMenu: true, cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: multiple, suppressSizeToFit: true, sortable: false, width: 40},
|
||||
{suppressMenu: true, cellClass:'text-center', sortable: false, field: 'sn', type:'sn', suppressSizeToFit: true, headerName: '', width: 40},
|
||||
{suppressMenu: true, cellClass:'text-center', sortable: false, field: 'warehouse_code', headerName: '仓库编码', width: 60},
|
||||
{suppressMenu: true, cellClass:'text-left', sortable: false, field: 'warehouse_name', headerName: '仓库名称', width: 100},
|
||||
{suppressMenu: true, cellClass:'text-left', sortable: false, field: 'product_code', headerName: '产品编码', width: 80},
|
||||
{suppressMenu: true, cellClass:'text-left', sortable: false, field: 'product_name', headerName: '产品名称', width: 160},
|
||||
{suppressMenu: true, cellClass:'text-left', sortable: false, field: 'product_spec', headerName: '规格型号', width: 100},
|
||||
|
||||
{suppressMenu: true, cellClass:'text-center', sortable: false, field: 'batch_sn', headerName: '生产批号', width: 80},
|
||||
{suppressMenu: true, cellClass:'text-center', sortable: false, field: 'batch_date', headerName: '生产日期', width: 80},
|
||||
{suppressMenu: true, cellClass:'text-center', sortable: false, field: 'poscode', headerName: '货位编码', width: 80},
|
||||
{suppressMenu: true, cellClass:'text-center', sortable: false, field: 'posname', headerName: '货位名称', width: 80},
|
||||
{suppressMenu: true, cellClass:'text-right', sortable: false, field: 'ky_num', type:'number', headerName: '可用数量', width: 80},
|
||||
];
|
||||
|
||||
grid.onRowClicked = function(row) {
|
||||
var selected = row.node.isSelected();
|
||||
if (selected === false) {
|
||||
row.node.setSelected(true, true);
|
||||
}
|
||||
};
|
||||
|
||||
grid.onRowDoubleClicked = function (row) {
|
||||
var ret = writeSelected();
|
||||
if (ret == true) {
|
||||
$('#gdoo-dialog-stock_select').dialog('close');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 写入选中
|
||||
*/
|
||||
function writeSelected() {
|
||||
var rows = grid.api.getSelectedRows();
|
||||
if (typeof window.stockRowsSelected == 'function') {
|
||||
return window.stockRowsSelected.call(grid, rows);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
$ref_stock_select = grid;
|
||||
|
||||
new agGrid.Grid(gridDiv, grid);
|
||||
|
||||
// 读取数据
|
||||
grid.remoteData({page: 1});
|
||||
|
||||
var data = search.forms;
|
||||
var search = $("#dialog-stock_select-search-form").searchForm({
|
||||
data: data
|
||||
});
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var params = search.serializeArray();
|
||||
$.map(params, function(row) {
|
||||
data[row.name] = row.value;
|
||||
});
|
||||
grid.remoteData(data);
|
||||
return false;
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,189 @@
|
||||
<div class="form-panel">
|
||||
<div class="form-panel-header">
|
||||
<div class="pull-right">
|
||||
</div>
|
||||
{{$form['btn']}}
|
||||
|
||||
@if($form['action'] == 'show')
|
||||
@else
|
||||
<a href="javascript:orderDialog();" class="btn btn-sm btn-default">
|
||||
参照客户订单
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
<div class="form-panel-body panel-form-{{$form['action']}}">
|
||||
<form class="form-horizontal form-controller" method="post" id="{{$form['table']}}" name="{{$form['table']}}">
|
||||
{{$form['tpl']}}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var table = '{{$form["table"]}}';
|
||||
var grid = null;
|
||||
|
||||
var tax_id = '{{$form["row"]["tax_id"]}}';
|
||||
var tax_type = $('#stock_cancel_tax_type').val();
|
||||
|
||||
function get_customer_id() {
|
||||
var customer_id = $('#stock_cancel_customer_id').val();
|
||||
return customer_id || 0;
|
||||
}
|
||||
|
||||
function has_customer_id() {
|
||||
var customer_id = get_customer_id();
|
||||
if (customer_id == 0) {
|
||||
toastrError('请先选择客户');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function get_customer_tax(customer_id, tax_id) {
|
||||
if (customer_id) {
|
||||
$.post(app.url('customer/tax/dialog'), {customer_id: customer_id}, function (res) {
|
||||
var html = '<option value=""> - </option>';
|
||||
$.each(res.data, function (i, row) {
|
||||
var selected = tax_id == row.id ? 'selected="selected"' : '';
|
||||
html += '<option value="' + row.id + '" ' + selected + '>' + row.name + '</option>';
|
||||
});
|
||||
$('#stock_cancel_tax_id').html(html);
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
|
||||
get_customer_tax(get_customer_id(), tax_id);
|
||||
|
||||
var orderDialog = function () {
|
||||
var buttons = [{
|
||||
text: "取消",
|
||||
'class': "btn-default",
|
||||
click: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}];
|
||||
buttons.push({
|
||||
text: '提交',
|
||||
'class': 'btn-info',
|
||||
click: function () {
|
||||
var row = $ref_customer_order.api.getSelectedRows()[0];
|
||||
if (row) {
|
||||
$('#stock_cancel_customer_id').val(row.customer_id);
|
||||
$('#stock_cancel_customer_id_text').val(row.customer_name);
|
||||
|
||||
$('#stock_cancel_tax_type').val(row.tax_type);
|
||||
$('#stock_cancel_tax_type_select').val(row.tax_type);
|
||||
|
||||
// 设置开票名称
|
||||
get_customer_tax(row.customer_id, row.tax_id);
|
||||
|
||||
$('#stock_cancel_order_type_id').val(row.type_id);
|
||||
$('#stock_cancel_order_type_id_select').val(row.type_id);
|
||||
|
||||
$('#stock_cancel_warehouse_contact').val(row.warehouse_contact);
|
||||
$('#stock_cancel_warehouse_phone').val(row.warehouse_phone);
|
||||
$('#stock_cancel_warehouse_tel').val(row.warehouse_tel);
|
||||
$('#stock_cancel_warehouse_address').val(row.warehouse_address);
|
||||
}
|
||||
|
||||
var rows = $ref_customer_order_data.api.getSelectedRows();
|
||||
grid.api.setRowData([]);
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
row.quantity = 0 - row.quantity;
|
||||
row.money = 0 - row.money;
|
||||
grid.api.memoryStore.create(row);
|
||||
}
|
||||
grid.generatePinnedBottomData();
|
||||
$(this).dialog('close');
|
||||
}
|
||||
});
|
||||
var v = $('#stock_cancel_customer_id_text').val();
|
||||
$.dialog({
|
||||
title: '客户订单',
|
||||
url: '{{url("order/order/serviceCancelOrder")}}?field_0=customer.name&condition_0=like&search_0=' + v,
|
||||
dialogClass: 'modal-lg',
|
||||
buttons: buttons
|
||||
});
|
||||
}
|
||||
|
||||
// grid初始化事件
|
||||
gdoo.event.set('grid.stock_cancel_data', {
|
||||
ready(me) {
|
||||
grid = me;
|
||||
grid.dataKey = 'product_id';
|
||||
},
|
||||
editable: {
|
||||
product_name(params) {
|
||||
return has_customer_id();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// 子表对话框
|
||||
gdoo.event.set('stock_cancel_data.warehouse_id', {
|
||||
open(params) {
|
||||
},
|
||||
query(query) {
|
||||
},
|
||||
onSelect(row, selected) {
|
||||
var pos = selected.pos;
|
||||
if (pos.length > 0) {
|
||||
row.poscode = pos[0].code;
|
||||
row.posname = pos[0].name;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 子表对话框
|
||||
gdoo.event.set('stock_cancel_data.product_id', {
|
||||
open(params) {
|
||||
params.url = 'product/product/serviceCustomer';
|
||||
},
|
||||
query(query) {
|
||||
query.customer_id = get_customer_id();
|
||||
},
|
||||
onSelect(row, selected) {
|
||||
row.type_id_name = '普通';
|
||||
row.type_id = 1;
|
||||
row.price = selected.price;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 选择货位编号
|
||||
gdoo.event.set('stock_cancel_data.poscode', {
|
||||
query(query) {
|
||||
var row = grid.lastEditCell.data;
|
||||
if (row.warehouse_id > 0) {
|
||||
query.warehouse_id = row.warehouse_id;
|
||||
}
|
||||
},
|
||||
onSelect(row, selectedRow) {
|
||||
row.poscode = selectedRow.code;
|
||||
row.posname = selectedRow.name;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 选择客户事件
|
||||
gdoo.event.set('stock_cancel.customer_id', {
|
||||
onSelect(row) {
|
||||
if (row.id) {
|
||||
$('#stock_cancel_order_type_id').val(row.type_id);
|
||||
$('#stock_cancel_order_type_id_select').val(row.type_id);
|
||||
|
||||
$('#stock_cancel_order_warehouse_contact').val(row.warehouse_contact);
|
||||
$('#stock_cancel_order_warehouse_phone').val(row.warehouse_phone);
|
||||
$('#stock_cancel_order_warehouse_tel').val(row.warehouse_tel);
|
||||
$('#stock_cancel_order_warehouse_address').val(row.warehouse_address);
|
||||
get_customer_tax(row.id);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,59 @@
|
||||
{{$header["js"]}}
|
||||
|
||||
<div class="panel no-border" id="{{$header['master_table']}}-controller">
|
||||
@include('headers')
|
||||
<div class='list-jqgrid'>
|
||||
<div id="{{$header['master_table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
var table = '{{$header["master_table"]}}';
|
||||
var config = gdoo.grids[table];
|
||||
var action = config.action;
|
||||
var search = config.search;
|
||||
|
||||
action.dialogType = 'layer';
|
||||
|
||||
// 自定义搜索方法
|
||||
search.searchInit = function (e) {
|
||||
var self = this;
|
||||
}
|
||||
|
||||
var options = new agGridOptions();
|
||||
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
|
||||
gridDiv.style.height = getPanelHeight(48);
|
||||
|
||||
options.remoteDataUrl = '{{url()}}';
|
||||
options.remoteParams = search.advanced.query;
|
||||
options.columnDefs = config.cols;
|
||||
options.onRowDoubleClicked = function (params) {
|
||||
if (params.node.rowPinned) {
|
||||
return;
|
||||
}
|
||||
if (params.data == undefined) {
|
||||
return;
|
||||
}
|
||||
if (params.data.master_id > 0) {
|
||||
action.show(params.data);
|
||||
}
|
||||
};
|
||||
|
||||
new agGrid.Grid(gridDiv, options);
|
||||
|
||||
// 读取数据
|
||||
options.remoteData({page: 1});
|
||||
|
||||
// 绑定自定义事件
|
||||
var $gridDiv = $(gridDiv);
|
||||
$gridDiv.on('click', '[data-toggle="event"]', function () {
|
||||
var data = $(this).data();
|
||||
if (data.master_id > 0) {
|
||||
action[data.action](data);
|
||||
}
|
||||
});
|
||||
config.grid = options;
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@include('footers')
|
||||
@@ -0,0 +1 @@
|
||||
{{$form['tpl']}}
|
||||
@@ -0,0 +1,144 @@
|
||||
<div id="div1">
|
||||
<div style="line-height:40px;font-size:14pt;" align=center><strong><font>{{$setting['print_title']}}{{$form['template']['name']}}</font></strong></div>
|
||||
<table width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="70%">客户名称:{{$master['tax_name']}}</td>
|
||||
<td width="30%">退货日期:{{$master['invoice_dt']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>单据编号:{{$master['sn']}}</td>
|
||||
<td>销售类型:{{$master['type_name']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">备注:{{$master['remark']}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="div2">
|
||||
<style type="text/css">
|
||||
td { padding: 5px; }
|
||||
</style>
|
||||
<table width="100%" border="1" style="font-size:12pt;">
|
||||
<thead>
|
||||
<tr>
|
||||
<td align="center">产品名称</td>
|
||||
<td align="center">规格型号</td>
|
||||
<td align="center">单位</td>
|
||||
<td align="center">数量</td>
|
||||
<td align="center">单价</td>
|
||||
<td align="center">金额</td>
|
||||
<td align="center">重量(kg)</td>
|
||||
<td align="center">批次</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($rows as $row)
|
||||
<tr>
|
||||
<td align="center">
|
||||
{{$row['product_name']}}
|
||||
</td>
|
||||
<td align="center">
|
||||
{{$row['product_spec']}}
|
||||
</td>
|
||||
<td align="center">
|
||||
{{$row['product_unit']}}
|
||||
</td>
|
||||
<td align="center">
|
||||
{{floatval($row['quantity'])}}
|
||||
</td>
|
||||
<td align="center">
|
||||
@number($row['price'], 2)
|
||||
</td>
|
||||
<td align="center">
|
||||
@number($row['money'], 2)
|
||||
</td>
|
||||
<td align="center">
|
||||
@number($row['total_weight'], 2)
|
||||
</td>
|
||||
<td align="center">
|
||||
{{$row['batch_sn']}}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
<tr>
|
||||
<td align="center">合计</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td align="center">{{floatval($rows->sum('quantity'))}}</td>
|
||||
<td></td>
|
||||
<td align="center">@number($rows->sum('money'), 2)</td>
|
||||
<td align="center">@number($rows->sum('total_weight'), 2)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="div3">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td width="25%">制单:{{$master['created_by']}}</td>
|
||||
<td width="25%">财务:李彩</td>
|
||||
<td width="25%">发货:</td>
|
||||
<td width="25%">仓管:</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="div4">
|
||||
<div align="center">第<font tdata="PageNO">##</font>页,<font tdata="PageCount">##</font></span>页</div>
|
||||
</div>
|
||||
|
||||
<script language="javascript" src="{{$asset_url}}/vendor/LodopFuncs.js"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
var LODOP;
|
||||
function print280() {
|
||||
LODOP = getLodop();
|
||||
LODOP.PRINT_INIT("{{$form['template']['name']}}");
|
||||
LODOP.SET_PRINT_PAGESIZE(0, 2100, 2700, "CreateCustomPage");
|
||||
|
||||
var strStyle = "<style> table,td,th {border-width:1px;border-style:solid;border-collapse:collapse}</style>";
|
||||
|
||||
LODOP.ADD_PRINT_TABLE(125, "4%", "92%", 420, strStyle + document.getElementById("div2").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"Vorient", 3);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, "4%", "92%", 120, document.getElementById("div1").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, 0, "92%", 54, document.getElementById("div3").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"LinkedItem", -2);
|
||||
|
||||
LODOP.ADD_PRINT_HTM('96%', "4%","92%", 22, document.getElementById("div4").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.PREVIEW();
|
||||
};
|
||||
|
||||
function print140() {
|
||||
LODOP = getLodop();
|
||||
LODOP.PRINT_INIT("{{$form['template']['name']}}");
|
||||
LODOP.SET_PRINT_PAGESIZE(0, 2100, 1400, "CreateCustomPage");
|
||||
|
||||
var strStyle = "<style> table,td,th {border-width:1px;border-style:solid;border-collapse:collapse}</style>";
|
||||
|
||||
LODOP.ADD_PRINT_TABLE(125, "4%", "92%", 420, strStyle + document.getElementById("div2").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"Vorient", 3);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, "4%", "92%", 120, document.getElementById("div1").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, 0, "92%", 54, document.getElementById("div3").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"LinkedItem", -2);
|
||||
|
||||
LODOP.ADD_PRINT_HTM('93%', "4%","92%", 22, document.getElementById("div4").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.PREVIEW();
|
||||
};
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,109 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<div class="wrapper-sm" style="padding-bottom:0;">
|
||||
<div id="dialog-promotion-toolbar">
|
||||
<form id="dialog-promotion-search-form" name="dialog_promotion_search_form" class="search-inline-form form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_promotion" class="ag-theme-balham" style="width:100%;height:140px;"></div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_promotion_data" class="ag-theme-balham" style="width:100%;height:240px;"></div>
|
||||
</div>
|
||||
<script>
|
||||
var $ref_promotion = null;
|
||||
var $ref_promotion_data = null;
|
||||
var params = JSON.parse('{{json_encode($query)}}');
|
||||
(function($) {
|
||||
params['master'] = 1;
|
||||
var mGridDiv = document.querySelector("#ref_promotion");
|
||||
var mGrid = new agGridOptions();
|
||||
mGrid.remoteDataUrl = '{{url()}}';
|
||||
mGrid.remoteParams = params;
|
||||
mGrid.rowMultiSelectWithClick = false;
|
||||
mGrid.rowSelection = 'multiple';
|
||||
mGrid.autoColumnsToFit = false;
|
||||
mGrid.defaultColDef.suppressMenu = true;
|
||||
mGrid.defaultColDef.sortable = false;
|
||||
mGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'sn', headerName: '促销编号', minWidth: 160},
|
||||
{cellClass:'text-center', field: 'created_at', type: 'datetime', headerName: '单据日期', width: 120},
|
||||
{cellClass:'text-center', field: 'status', headerName: '状态', width: 160},
|
||||
{cellClass:'text-center', field: 'customer_code', headerName: '客户编码', width: 160},
|
||||
{field:'customer_name', headerName: '客户名称', width: 160},
|
||||
{field:'warehouse_contact', headerName: '收货人', width: 160},
|
||||
{field:'warehouse_phone', headerName: '收货人电话', width: 160},
|
||||
{field:'warehouse_address', headerName: '收货地址', width: 260},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
mGrid.onSelectionChanged = function() {
|
||||
var rows = mGrid.api.getSelectedRows();
|
||||
var ids = [];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
ids.push(rows[i].id);
|
||||
}
|
||||
params.promotion_ids = ids;
|
||||
sGrid.remoteData(params);
|
||||
};
|
||||
new agGrid.Grid(mGridDiv, mGrid);
|
||||
// 读取数据
|
||||
mGrid.remoteData();
|
||||
$ref_promotion = mGrid;
|
||||
|
||||
params['master'] = 0;
|
||||
var sGridDiv = document.querySelector("#ref_promotion_data");
|
||||
var sGrid = new agGridOptions();
|
||||
sGrid.remoteDataUrl = '{{url()}}';
|
||||
sGrid.remoteParams = params;
|
||||
sGrid.rowMultiSelectWithClick = true;
|
||||
sGrid.rowSelection = 'multiple';
|
||||
sGrid.autoColumnsToFit = false;
|
||||
sGrid.defaultColDef.suppressMenu = true;
|
||||
sGrid.defaultColDef.sortable = false;
|
||||
sGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'product_code', headerName: '存货编码', width: 100},
|
||||
{field: 'product_name', headerName: '商品名称', minWidth: 180},
|
||||
{cellClass:'text-center', field: 'product_spec', headerName: '商品规格', width: 140},
|
||||
{cellClass:'text-center', field: 'unit_name', headerName: '计量单位', width: 80},
|
||||
{cellClass:'text-center', field: 'discount_rate', headerName: '现存量', width: 80},
|
||||
{cellClass:'text-right', field: 'total_quantity', headerName: '促销数量', width: 80},
|
||||
{cellClass:'text-right', field: 'use_quantity', headerName: '已发数量', width: 80},
|
||||
{cellClass:'text-right', field: 'quantity', headerName: '可用数量', width: 80},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
new agGrid.Grid(sGridDiv, sGrid);
|
||||
// 读取数据
|
||||
sGrid.remoteData();
|
||||
$ref_promotion_data = sGrid;
|
||||
|
||||
var data = JSON.parse('{{json_encode($search["forms"])}}');
|
||||
var search = $('#dialog-promotion-search-form').searchForm({
|
||||
data: data,
|
||||
init:function(e) {}
|
||||
});
|
||||
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var query = search.serializeArray();
|
||||
$.map(query, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
|
||||
params['master'] = 1;
|
||||
mGrid.remoteData(params);
|
||||
|
||||
params['master'] = 0;
|
||||
sGrid.remoteData(params);
|
||||
return false;
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,3 @@
|
||||
<form class="form-horizontal form-controller" method="post" id="stock_type" name="stock_type">
|
||||
{{$form['tpl']}}
|
||||
</form>
|
||||
@@ -0,0 +1,123 @@
|
||||
<div class="padder">
|
||||
<div class="m-t-sm m-b-sm">
|
||||
<form id="dialog-{{$search['query']['id']}}-search-form" class="form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="dialog-{{$search['query']['id']}}" class="ag-theme-balham" style="width:100%;height:380px;"></div>
|
||||
|
||||
<script>
|
||||
(function ($) {
|
||||
var search = JSON.parse('{{json_encode($search)}}');
|
||||
var params = search.query;
|
||||
var sid = params.prefix == 1 ? 'sid' : 'id';
|
||||
var gridDiv = document.querySelector("#dialog-{{$search['query']['id']}}");
|
||||
var grid = new agGridOptions();
|
||||
|
||||
var option = gdoo.formKey(params);
|
||||
var event = gdoo.event.get(option.key);
|
||||
event.trigger('query', params);
|
||||
|
||||
var multiple = params.multi == 0 ? false : true;
|
||||
grid.remoteDataUrl = '{{url()}}';
|
||||
grid.remoteParams = params;
|
||||
grid.rowSelection = multiple ? 'multiple' : 'single';
|
||||
grid.suppressRowClickSelection = true;
|
||||
grid.columnDefs = [
|
||||
{suppressMenu: true, cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: multiple, suppressSizeToFit: true, sortable: false, width: 40},
|
||||
{suppressMenu: true, cellClass:'text-center', sortable: false, field: 'code', headerName: '编码', width: 100},
|
||||
{suppressMenu: true, cellClass:'text-center', sortable: false, field: 'name', headerName: '名称', minWidth: 160},
|
||||
{suppressMenu: true, cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
grid.onRowClicked = function(row) {
|
||||
var selected = row.node.isSelected();
|
||||
if (selected === false) {
|
||||
row.node.setSelected(true, true);
|
||||
}
|
||||
};
|
||||
|
||||
grid.onRowDoubleClicked = function (row) {
|
||||
var ret = writeSelected();
|
||||
if (ret == true) {
|
||||
$('#gdoo-dialog-' + params.dialog_index).dialog('close');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 初始化选择
|
||||
*/
|
||||
function initSelected() {
|
||||
if (params.is_grid) {
|
||||
} else {
|
||||
var rows = {};
|
||||
var id = $('#'+option.id).val();
|
||||
if (id) {
|
||||
var ids = id.split(',');
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
rows[ids[i]] = ids[i];
|
||||
}
|
||||
}
|
||||
grid.api.forEachNode(function(node) {
|
||||
var key = node.data[sid];
|
||||
if (rows[key] != undefined) {
|
||||
node.setSelected(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入选中
|
||||
*/
|
||||
function writeSelected() {
|
||||
var rows = grid.api.getSelectedRows();
|
||||
if (params.is_grid) {
|
||||
var list = gdoo.forms[params.form_id];
|
||||
list.api.dialogSelected(params);
|
||||
} else {
|
||||
var id = [];
|
||||
var text = [];
|
||||
$.each(rows, function(k, row) {
|
||||
id.push(row[sid]);
|
||||
text.push(row.name);
|
||||
});
|
||||
$('#'+option.id).val(id.join(','));
|
||||
$('#'+option.id+'_text').val(text.join(','));
|
||||
|
||||
if (event.exist('onSelect')) {
|
||||
return event.trigger('onSelect', multiple ? rows : rows[0]);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
grid.writeSelected = writeSelected;
|
||||
gdoo.dialogs[option.id] = grid;
|
||||
|
||||
new agGrid.Grid(gridDiv, grid);
|
||||
|
||||
// 读取数据
|
||||
grid.remoteData({page: 1});
|
||||
|
||||
// 数据载入成功
|
||||
grid.remoteSuccessed = function() {
|
||||
initSelected();
|
||||
}
|
||||
|
||||
var data = search.forms;
|
||||
var search = $("#dialog-{{$search['query']['id']}}-search-form").searchForm({
|
||||
data: data
|
||||
});
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var params = search.serializeArray();
|
||||
$.map(params, function(row) {
|
||||
data[row.name] = row.value;
|
||||
});
|
||||
grid.remoteData(data);
|
||||
return false;
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,57 @@
|
||||
{{$header["js"]}}
|
||||
|
||||
<div class="panel no-border" id="{{$header['table']}}-controller">
|
||||
@include('headers')
|
||||
<div class='list-jqgrid'>
|
||||
<div id="{{$header['table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
var table = '{{$header["table"]}}';
|
||||
var config = gdoo.grids[table];
|
||||
var action = config.action;
|
||||
var search = config.search;
|
||||
|
||||
// 自定义搜索方法
|
||||
search.searchInit = function (e) {
|
||||
var self = this;
|
||||
}
|
||||
|
||||
var options = new agGridOptions();
|
||||
var gridDiv = document.querySelector("#{{$header['table']}}-grid");
|
||||
gridDiv.style.height = getPanelHeight(48);
|
||||
|
||||
options.remoteDataUrl = '{{url()}}';
|
||||
options.remoteParams = search.advanced.query;
|
||||
options.columnDefs = config.cols;
|
||||
options.onRowDoubleClicked = function (params) {
|
||||
if (params.node.rowPinned) {
|
||||
return;
|
||||
}
|
||||
if (params.data == undefined) {
|
||||
return;
|
||||
}
|
||||
if (params.data.id > 0) {
|
||||
action.edit(params.data);
|
||||
}
|
||||
};
|
||||
|
||||
new agGrid.Grid(gridDiv, options);
|
||||
|
||||
// 读取数据
|
||||
options.remoteData({page: 1});
|
||||
|
||||
// 绑定自定义事件
|
||||
var $gridDiv = $(gridDiv);
|
||||
$gridDiv.on('click', '[data-toggle="event"]', function () {
|
||||
var data = $(this).data();
|
||||
if (data.master_id > 0) {
|
||||
action[data.action](data);
|
||||
}
|
||||
});
|
||||
config.grid = options;
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@include('footers')
|
||||
@@ -0,0 +1,485 @@
|
||||
<div class="form-panel">
|
||||
<div class="form-panel-header">
|
||||
<div class="pull-right">
|
||||
</div>
|
||||
{{$form['btn']}}
|
||||
|
||||
@if($form['action'] == 'show')
|
||||
@else
|
||||
@if($form['row']['id'] > 0)
|
||||
@else
|
||||
<a href="javascript:orderDialog();" class="btn btn-sm btn-default">
|
||||
参照客户订单
|
||||
</a>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@if($form['row']['id'] > 0)
|
||||
<a href="javascript:logisticsDialog();" class="btn btn-sm btn-default">
|
||||
物流信息
|
||||
</a>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
<div class="form-panel-body panel-form-{{$form['action']}}">
|
||||
<form class="form-horizontal form-controller" method="post" id="{{$form['table']}}" name="{{$form['table']}}">
|
||||
{{$form['tpl']}}
|
||||
|
||||
@if($form['action'] == 'show')
|
||||
@else
|
||||
<input type="hidden" id="stock_delivery_freight_short_logistics_id" name="stock_delivery[freight_short_logistics_id]">
|
||||
<input type="hidden" id="stock_delivery_freight_short_car" name="stock_delivery[freight_short_car]">
|
||||
@endif
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var table = '{{$form["table"]}}';
|
||||
var rowId = '{{$form["row"]["id"]}}';
|
||||
var tax_id = '{{$form["row"]["tax_id"]}}';
|
||||
var grid = null;
|
||||
(function ($) {
|
||||
function get_customer_tax(customer_id, tax_id) {
|
||||
if (customer_id) {
|
||||
$.post(app.url('customer/tax/dialog'), {customer_id: customer_id}, function (res) {
|
||||
var html = '<option value=""> - </option>';
|
||||
$.each(res.data, function (i, row) {
|
||||
var selected = tax_id == row.id ? 'selected="selected"' : '';
|
||||
html += '<option value="' + row.id + '" ' + selected + '>' + row.name + '</option>';
|
||||
});
|
||||
$('#stock_delivery_tax_id').html(html);
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
get_customer_tax(get_customer_id(), tax_id);
|
||||
|
||||
// 获取生产批号
|
||||
function getBatchSelect(warehouse_id, product_id, batchs, customer_id, fun) {
|
||||
$.post(app.url('stock/delivery/getBatchSelect'), {
|
||||
warehouse_id: warehouse_id,
|
||||
product_id: product_id,
|
||||
customer_id: customer_id,
|
||||
value: batchs
|
||||
}, function(res) {
|
||||
fun(res);
|
||||
});
|
||||
}
|
||||
|
||||
var orderDialog = function () {
|
||||
var buttons = [{
|
||||
text: "取消",
|
||||
'class': "btn-default",
|
||||
click: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}];
|
||||
buttons.push({
|
||||
text: '提交',
|
||||
'class': 'btn-info',
|
||||
click: function () {
|
||||
var me = this;
|
||||
var orders = $ref_customer_order.api.getSelectedRows();
|
||||
if (orders.length > 0) {
|
||||
|
||||
var has = {};
|
||||
for (var i = 0; i < orders.length; i++) {
|
||||
has[orders[i].tax_id] = 1;
|
||||
}
|
||||
if (Object.keys(has).length > 1) {
|
||||
$.messager.alert('操作警告', '参照订单开票单位必须一致。');
|
||||
return;
|
||||
}
|
||||
|
||||
var master = orders[0];
|
||||
|
||||
grid.api.forEachNode(function (node) {
|
||||
var data = node.data;
|
||||
if (isEmpty(data.product_id)) {
|
||||
grid.api.updateRowData({remove:[data]});
|
||||
}
|
||||
});
|
||||
|
||||
// 合并商品
|
||||
var products = {};
|
||||
var batchs = {};
|
||||
var rows = $ref_customer_order_data.api.getSelectedRows();
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
// 跳过费用
|
||||
if (row.product_code == '99001') {
|
||||
continue;
|
||||
}
|
||||
var product = parseFloat(products[row.product_id]);
|
||||
if (isNaN(product)) {
|
||||
products[row.product_id] = 0;
|
||||
}
|
||||
batchs[row.batch_sn] = row.batch_sn;
|
||||
products[row.product_id] += parseFloat(row.wf_num);
|
||||
}
|
||||
|
||||
var loading = layer.msg('数据提交中...', {
|
||||
icon: 16, shade: 0.1, time: 1000 * 120
|
||||
});
|
||||
|
||||
var product_ids = Object.keys(products).join(',');
|
||||
var batch_ids = Object.keys(batchs).join(',');
|
||||
if (batch_ids == 'null') {
|
||||
batch_ids = '';
|
||||
}
|
||||
getBatchSelect(0, product_ids, batch_ids, master.customer_id, function(res) {
|
||||
var batch_list = {};
|
||||
for (let k = 0; k < res.data.length; k++) {
|
||||
var row = res.data[k];
|
||||
if (batch_list[row.product_id] == undefined) {
|
||||
batch_list[row.product_id] = [];
|
||||
}
|
||||
batch_list[row.product_id].push(row);
|
||||
}
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
var quantity = parseFloat(row.wf_num);
|
||||
// 折扣额使用
|
||||
if (row.product_code == '99001') {
|
||||
row.quantity = '';
|
||||
grid.api.memoryStore.create(row);
|
||||
} else {
|
||||
// 产品库存不足
|
||||
if (row.ky_num <= 0) {
|
||||
continue;
|
||||
}
|
||||
var ret = false;
|
||||
|
||||
var _batchs = batch_list[row.product_id];
|
||||
|
||||
if(_batchs == undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (var j = 0; j < _batchs.length; j++) {
|
||||
var batch = _batchs[j];
|
||||
var ky_num = parseFloat(batch.ky_num);
|
||||
if (ky_num <= 0) {
|
||||
continue;
|
||||
}
|
||||
var item = jQuery.extend({}, row);
|
||||
if (quantity > ky_num) {
|
||||
item.quantity = ky_num;
|
||||
quantity = quantity - ky_num;
|
||||
} else {
|
||||
ret = true;
|
||||
item.quantity = quantity;
|
||||
}
|
||||
// 减少批号可用量
|
||||
batch.ky_num = ky_num - item.quantity;
|
||||
|
||||
item.warehouse_id = batch.warehouse_id;
|
||||
item.warehouse_id_name = batch.warehouse_name;
|
||||
item.batch_sn = batch.batch_sn;
|
||||
item.batch_date = batch.batch_date;
|
||||
item.poscode = batch.poscode;
|
||||
item.posname = batch.posname;
|
||||
|
||||
item.total_weight = item.quantity * item.weight;
|
||||
item.money = item.quantity * item.price;
|
||||
// 赠品
|
||||
if (item.type_id == 2) {
|
||||
item.other_money = item.money;
|
||||
}
|
||||
grid.api.memoryStore.create(item);
|
||||
// 单个产品写入结束
|
||||
if (ret == true) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#stock_delivery_customer_id').val(master.customer_id);
|
||||
$('#stock_delivery_customer_id_text').val(master.customer_name);
|
||||
$('#stock_delivery_invoice_dt').val(master.plan_delivery_dt);
|
||||
|
||||
$('#stock_delivery_freight_short_logistics_id').val(master.freight_short_logistics_id);
|
||||
$('#stock_delivery_freight_short_car').val(master.freight_short_car);
|
||||
$('#stock_delivery_freight_pay_text').val(master.freight_pay_text);
|
||||
|
||||
$('#stock_delivery_tax_type').val(master.tax_type);
|
||||
$('#stock_delivery_tax_id').html('<option selected="selected" value="' + master.tax_id + '">' + master.tax_name + '</option>');
|
||||
|
||||
$('#stock_delivery_order_type_id').val(master.type_id);
|
||||
$('#stock_delivery_order_type_id_select').val(master.type_id);
|
||||
|
||||
$('#stock_delivery_warehouse_contact').val(master.warehouse_contact);
|
||||
$('#stock_delivery_warehouse_phone').val(master.warehouse_phone);
|
||||
$('#stock_delivery_warehouse_tel').val(master.warehouse_tel);
|
||||
$('#stock_delivery_warehouse_address').val(master.warehouse_address);
|
||||
$('#stock_delivery_remark').val(master.remark);
|
||||
|
||||
grid.generatePinnedBottomData();
|
||||
$(me).dialog('close');
|
||||
|
||||
// 自动提交
|
||||
var query = $('#' + table).serialize();
|
||||
|
||||
// 循环子表
|
||||
var gets = gridListData(table);
|
||||
if(gets === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
var loading = layer.msg('数据提交中...', {
|
||||
icon: 16, shade: 0.1, time: 1000 * 120
|
||||
});
|
||||
$.post(app.url('stock/delivery/autoSave'), query + '&' + $.param(gets), function (res) {
|
||||
if (res.status) {
|
||||
toastrSuccess(res.data);
|
||||
if (res.url) {
|
||||
location.href = res.url;
|
||||
}
|
||||
} else {
|
||||
toastrError(res.data);
|
||||
}
|
||||
}, 'json').complete(function() {
|
||||
layer.close(loading);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
toastrError('销售订单必须选择。');
|
||||
}
|
||||
}
|
||||
});
|
||||
var v = $('#stock_delivery_customer_id_text').val();
|
||||
$.dialog({
|
||||
title: '客户订单',
|
||||
url: '{{url("order/order/serviceDelivery")}}?is_direct=0&field_0=customer.name&condition_0=like&search_0=' + v,
|
||||
dialogClass: 'modal-lg',
|
||||
buttons: buttons
|
||||
});
|
||||
}
|
||||
|
||||
var logisticsDialog = function () {
|
||||
formDialog({
|
||||
title: '物流信息',
|
||||
url: app.url('stock/delivery/logistics', {id: rowId}),
|
||||
storeUrl: app.url('stock/delivery/logistics'),
|
||||
id: 'delivery_logistics',
|
||||
dialogClass:'modal-md',
|
||||
success: function(res) {
|
||||
toastrSuccess(res.data);
|
||||
grid.remoteData();
|
||||
$(this).dialog("close");
|
||||
},
|
||||
error: function(res) {
|
||||
toastrError(res.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.logisticsDialog = logisticsDialog;
|
||||
|
||||
// grid初始化事件
|
||||
gdoo.event.set('grid.stock_delivery_data', {
|
||||
ready(me) {
|
||||
grid = me;
|
||||
grid.dataKey = 'product_id';
|
||||
},
|
||||
editable: {
|
||||
product_name(params) {
|
||||
return has_customer_id();
|
||||
},
|
||||
batch_sn(params) {
|
||||
var row = params.data;
|
||||
if (row.product_id > 0) {
|
||||
} else {
|
||||
toastrError('请先选择产品');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
poscode(params) {
|
||||
var row = params.data;
|
||||
if (row.warehouse_id > 0) {
|
||||
} else {
|
||||
toastrError('请先选择仓库');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
onSaveBefore(rows) {
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
var quantity = toNumber(row.quantity);
|
||||
var price = toNumber(row.price);
|
||||
var money = toNumber(row.money).toFixed(2);
|
||||
var other_money = toNumber(row.other_money).toFixed(2);
|
||||
var new_money = (quantity * price).toFixed(2);
|
||||
if (quantity > 0 && price > 0) {
|
||||
if (new_money != money) {
|
||||
toastrError(row.product_name + ' 实发数量 * 单价不等于金额');
|
||||
return false;
|
||||
}
|
||||
if (other_money > 0) {
|
||||
if (other_money != money) {
|
||||
toastrError(row.product_name + '其他金额不等于金额');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 选择产品
|
||||
gdoo.event.set('stock_delivery_data.product_id', {
|
||||
open(params) {
|
||||
params.url = 'product/product/serviceCustomer';
|
||||
},
|
||||
query(query) {
|
||||
query.customer_id = get_customer_id();
|
||||
},
|
||||
onSelect(row, selectedRow) {
|
||||
row.type_id_name = '普通';
|
||||
row.type_id = 1;
|
||||
row.price = selectedRow.price;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
function get_customer_id() {
|
||||
var customer_id = $('#stock_delivery_customer_id').val();
|
||||
return customer_id || 0;
|
||||
}
|
||||
|
||||
function has_customer_id() {
|
||||
var customer_id = get_customer_id();
|
||||
if (customer_id == 0) {
|
||||
toastrError('请先选择客户');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 选择生产批号
|
||||
gdoo.event.set('stock_delivery_data.batch_sn', {
|
||||
open(params) {
|
||||
params.title = '选择库存现存量';
|
||||
params.url = 'stock/delivery/getBatchSelect';
|
||||
},
|
||||
query(query) {
|
||||
var row = grid.lastEditCell.data;
|
||||
console.log(row);
|
||||
if (row.product_id > 0) {
|
||||
query.product_id = row.product_id;
|
||||
}
|
||||
},
|
||||
onSelect(row, batch) {
|
||||
var quantity = parseFloat(row.quantity);
|
||||
var ky_num = parseFloat(batch.ky_num);
|
||||
quantity = quantity - ky_num;
|
||||
if (quantity > 0) {
|
||||
row.quantity = ky_num;
|
||||
}
|
||||
row.warehouse_id = batch.warehouse_id;
|
||||
row.warehouse_id_name = batch.warehouse_name;
|
||||
row.batch_sn = batch.batch_sn;
|
||||
row.batch_date = batch.batch_date;
|
||||
row.poscode = batch.poscode;
|
||||
row.posname = batch.posname;
|
||||
row.total_weight = row.quantity * row.weight;
|
||||
row.money = row.quantity * row.price;
|
||||
// 赠品
|
||||
if (row.type_id == 2) {
|
||||
row.other_money = row.money;
|
||||
}
|
||||
grid.api.memoryStore.update(row);
|
||||
|
||||
// 库存现存量不足写入剩余数量
|
||||
if (quantity > 0) {
|
||||
var item = jQuery.extend({}, row);
|
||||
item.quantity = quantity;
|
||||
item.warehouse_id = 0;
|
||||
item.warehouse_id_name = '';
|
||||
item.batch_sn = '';
|
||||
item.batch_date = '';
|
||||
item.poscode = '';
|
||||
item.posname = '';
|
||||
item.total_weight = item.quantity * item.weight;
|
||||
item.money = item.quantity * item.price;
|
||||
// 赠品
|
||||
if (item.type_id == 2) {
|
||||
item.other_money = item.money;
|
||||
}
|
||||
grid.api.memoryStore.create(item);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 选择货位编号
|
||||
gdoo.event.set('stock_delivery_data.poscode', {
|
||||
query(query) {
|
||||
var row = grid.lastEditCell.data;
|
||||
console.log(row);
|
||||
if (row.warehouse_id > 0) {
|
||||
query.warehouse_id = row.warehouse_id;
|
||||
}
|
||||
},
|
||||
onSelect(row, selectedRow) {
|
||||
row.poscode = selectedRow.code;
|
||||
row.posname = selectedRow.name;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 选择客户事件
|
||||
gdoo.event.set('stock_delivery.customer_id', {
|
||||
onSelect(row) {
|
||||
if (row.id) {
|
||||
$('#stock_delivery_order_type_id').val(row.type_id);
|
||||
$('#stock_delivery_order_type_id_select').val(row.type_id);
|
||||
|
||||
$('#stock_delivery_warehouse_contact').val(row.warehouse_contact);
|
||||
$('#stock_delivery_warehouse_phone').val(row.warehouse_phone);
|
||||
$('#stock_delivery_warehouse_tel').val(row.warehouse_tel);
|
||||
$('#stock_delivery_warehouse_address').val(row.warehouse_address);
|
||||
get_customer_tax(row.id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 选择短途运输人
|
||||
gdoo.event.set('stock_delivery.freight_short_logistics_id', {
|
||||
query(query) {
|
||||
},
|
||||
onSelect(row) {
|
||||
if (row.id) {
|
||||
$('#stock_delivery_freight_short_car').val(row.short_car_sn);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 选择物流公司
|
||||
gdoo.event.set('stock_delivery.freight_logistics_id', {
|
||||
query(query) {
|
||||
},
|
||||
onSelect(row) {
|
||||
if (row.id) {
|
||||
$('#stock_delivery_freight_logistics_phone').val(row.business_phone);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
window.orderDialog = orderDialog;
|
||||
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,60 @@
|
||||
{{$header["js"]}}
|
||||
|
||||
<div class="panel no-border" id="{{$header['master_table']}}-controller">
|
||||
@include('headers')
|
||||
<div class='list-jqgrid'>
|
||||
<div id="{{$header['master_table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
var table = '{{$header["master_table"]}}';
|
||||
var config = gdoo.grids[table];
|
||||
var action = config.action;
|
||||
var search = config.search;
|
||||
|
||||
action.dialogType = 'layer';
|
||||
|
||||
// 自定义搜索方法
|
||||
search.searchInit = function (e) {
|
||||
var self = this;
|
||||
}
|
||||
|
||||
var options = new agGridOptions();
|
||||
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
|
||||
gridDiv.style.height = getPanelHeight(48);
|
||||
|
||||
options.remoteDataUrl = '{{url()}}';
|
||||
options.remoteParams = search.advanced.query;
|
||||
options.columnDefs = config.cols;
|
||||
options.autoColumnsToFit = false;
|
||||
options.onRowDoubleClicked = function (params) {
|
||||
if (params.node.rowPinned) {
|
||||
return;
|
||||
}
|
||||
if (params.data == undefined) {
|
||||
return;
|
||||
}
|
||||
if (params.data.master_id > 0) {
|
||||
action.show(params.data);
|
||||
}
|
||||
};
|
||||
|
||||
new agGrid.Grid(gridDiv, options);
|
||||
|
||||
// 读取数据
|
||||
options.remoteData({page: 1});
|
||||
|
||||
// 绑定自定义事件
|
||||
var $gridDiv = $(gridDiv);
|
||||
$gridDiv.on('click', '[data-toggle="event"]', function () {
|
||||
var data = $(this).data();
|
||||
if (data.master_id > 0) {
|
||||
action[data.action](data);
|
||||
}
|
||||
});
|
||||
config.grid = options;
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@include('footers')
|
||||
@@ -0,0 +1,131 @@
|
||||
<div class="wrapper-xs">
|
||||
<form id="dialog-{{$search['query']['id']}}-search-form" class="form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="dialog-{{$search['query']['id']}}" class="ag-theme-balham" style="width:100%;height:380px;"></div>
|
||||
|
||||
<script>
|
||||
(function ($) {
|
||||
var search = JSON.parse('{{json_encode($search)}}');
|
||||
var params = search.query;
|
||||
|
||||
var option = gdoo.formKey(params);
|
||||
var event = gdoo.event.get(option.key);
|
||||
event.trigger('query', params);
|
||||
|
||||
var sid = params.prefix == 1 ? 'sid' : 'id';
|
||||
var gridDiv = document.querySelector("#dialog-{{$search['query']['id']}}");
|
||||
var grid = new agGridOptions();
|
||||
var selectedData = {};
|
||||
var multiple = false;
|
||||
grid.remoteDataUrl = '{{url()}}';
|
||||
grid.remoteParams = params;
|
||||
grid.suppressRowClickSelection = true;
|
||||
grid.rowSelection = multiple ? 'multiple' : 'single';
|
||||
grid.columnDefs = [
|
||||
{suppressMenu: true, cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: multiple, suppressSizeToFit: true, sortable: false, width: 40},
|
||||
{suppressMenu: true, cellClass:'text-center', sortable: false, field: 'sn', type:'sn', suppressSizeToFit: true, headerName: '', width: 40},
|
||||
{suppressMenu: true, cellClass:'text-center', sortable: false, field: 'warehouse_code', headerName: '仓库编码', width: 60},
|
||||
{suppressMenu: true, cellClass:'text-left', sortable: false, field: 'warehouse_name', headerName: '仓库名称', width: 100},
|
||||
{suppressMenu: true, cellClass:'text-left', sortable: false, field: 'product_code', headerName: '产品编码', width: 80},
|
||||
{suppressMenu: true, cellClass:'text-left', sortable: false, field: 'product_name', headerName: '产品名称', width: 160},
|
||||
{suppressMenu: true, cellClass:'text-left', sortable: false, field: 'product_spec', headerName: '规格型号', width: 100},
|
||||
|
||||
{suppressMenu: true, cellClass:'text-center', sortable: false, field: 'batch_sn', headerName: '生产批号', width: 80},
|
||||
{suppressMenu: true, cellClass:'text-center', sortable: false, field: 'batch_date', headerName: '生产日期', width: 80},
|
||||
{suppressMenu: true, cellClass:'text-center', sortable: false, field: 'poscode', headerName: '货位编码', width: 80},
|
||||
{suppressMenu: true, cellClass:'text-center', sortable: false, field: 'posname', headerName: '货位名称', width: 80},
|
||||
{suppressMenu: true, cellClass:'text-right', sortable: false, field: 'ky_num', type:'number', headerName: '可用数量', width: 80},
|
||||
];
|
||||
|
||||
grid.onRowClicked = function(row) {
|
||||
var selected = row.node.isSelected();
|
||||
if (selected === false) {
|
||||
row.node.setSelected(true, true);
|
||||
}
|
||||
};
|
||||
|
||||
grid.onRowDoubleClicked = function (row) {
|
||||
var ret = writeSelected();
|
||||
if (ret == true) {
|
||||
$('#gdoo-dialog-' + params.dialog_index).dialog('close');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 初始化选择
|
||||
*/
|
||||
function initSelected() {
|
||||
if (params.is_grid) {
|
||||
} else {
|
||||
var rows = {};
|
||||
var id = $('#'+option.id).val();
|
||||
if (id) {
|
||||
var ids = id.split(',');
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
rows[ids[i]] = ids[i];
|
||||
}
|
||||
}
|
||||
grid.api.forEachNode(function(node) {
|
||||
var key = node.data[sid];
|
||||
if (rows[key] != undefined) {
|
||||
node.setSelected(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入选中
|
||||
*/
|
||||
function writeSelected() {
|
||||
var rows = grid.api.getSelectedRows();
|
||||
if (params.is_grid) {
|
||||
var list = gdoo.forms[params.form_id];
|
||||
list.api.dialogSelected(params);
|
||||
} else {
|
||||
var id = [];
|
||||
var text = [];
|
||||
$.each(rows, function(k, row) {
|
||||
id.push(row[sid]);
|
||||
text.push(row.name);
|
||||
});
|
||||
$('#'+option.id).val(id.join(','));
|
||||
$('#'+option.id+'_text').val(text.join(','));
|
||||
|
||||
if (event.exist('onSelect')) {
|
||||
return event.trigger('onSelect', multiple ? rows : rows[0]);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
grid.writeSelected = writeSelected;
|
||||
gdoo.dialogs[option.id] = grid;
|
||||
|
||||
new agGrid.Grid(gridDiv, grid);
|
||||
|
||||
// 读取数据
|
||||
grid.remoteData({page: 1});
|
||||
|
||||
// 数据载入成功
|
||||
grid.remoteSuccessed = function() {
|
||||
initSelected();
|
||||
}
|
||||
|
||||
var data = search.forms;
|
||||
var search = $("#dialog-{{$search['query']['id']}}-search-form").searchForm({
|
||||
data: data
|
||||
});
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var params = search.serializeArray();
|
||||
$.map(params, function(row) {
|
||||
data[row.name] = row.value;
|
||||
});
|
||||
grid.remoteData(data);
|
||||
return false;
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,60 @@
|
||||
{{$header["js"]}}
|
||||
|
||||
<div class="panel no-border" id="{{$header['master_table']}}-controller">
|
||||
@include('headers')
|
||||
<div class='list-jqgrid'>
|
||||
<div id="{{$header['master_table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
var table = '{{$header["master_table"]}}';
|
||||
var config = gdoo.grids[table];
|
||||
var action = config.action;
|
||||
var search = config.search;
|
||||
|
||||
action.dialogType = 'layer';
|
||||
|
||||
// 自定义搜索方法
|
||||
search.searchInit = function (e) {
|
||||
var self = this;
|
||||
}
|
||||
|
||||
var options = new agGridOptions();
|
||||
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
|
||||
gridDiv.style.height = getPanelHeight(48);
|
||||
|
||||
options.remoteDataUrl = '{{url()}}';
|
||||
options.remoteParams = search.advanced.query;
|
||||
options.columnDefs = config.cols;
|
||||
options.autoColumnsToFit = false;
|
||||
options.onRowDoubleClicked = function (params) {
|
||||
if (params.node.rowPinned) {
|
||||
return;
|
||||
}
|
||||
if (params.data == undefined) {
|
||||
return;
|
||||
}
|
||||
if (params.data.master_id > 0) {
|
||||
action.show(params.data);
|
||||
}
|
||||
};
|
||||
|
||||
new agGrid.Grid(gridDiv, options);
|
||||
|
||||
// 读取数据
|
||||
options.remoteData({page: 1});
|
||||
|
||||
// 绑定自定义事件
|
||||
var $gridDiv = $(gridDiv);
|
||||
$gridDiv.on('click', '[data-toggle="event"]', function () {
|
||||
var data = $(this).data();
|
||||
if (data.master_id > 0) {
|
||||
action[data.action](data);
|
||||
}
|
||||
});
|
||||
config.grid = options;
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@include('footers')
|
||||
@@ -0,0 +1,87 @@
|
||||
<gdoo>
|
||||
<view id="logistics">
|
||||
<style>
|
||||
#delivery_logistics {
|
||||
padding: 0;
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
#delivery_logistics .form-group:first-child > div {
|
||||
border: 0;
|
||||
}
|
||||
#delivery_logistics .control-label {
|
||||
padding: 5px;
|
||||
padding-top: 11px;
|
||||
display: block;
|
||||
font-weight: 400;
|
||||
}
|
||||
#delivery_logistics .control-text {
|
||||
padding: 5px;
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<form class="form-horizontal form-controller" method="post" id="delivery_logistics" name="delivery_logistics">
|
||||
<group>
|
||||
<field name="freight_quantity" options="" label="1" col_name="4" col_label="2" col_type="xs" />
|
||||
<field name="freight_weight" label="1" col_name="4" col_label="2" col_type="xs" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="freight_part_quantity" label="1" col_name="4" col_label="2" col_type="xs" />
|
||||
<field name="freight_part_weight" label="1" col_name="4" col_label="2" col_type="xs" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="freight_short_logistics_id" label="1" col_name="4" col_label="2" col_type="xs" />
|
||||
<field name="freight_short_car" label="1" col_name="4" col_label="2" col_type="xs" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="freight_price" label="1" col_name="4" col_label="2" col_type="xs" />
|
||||
<field name="freight_short_money" label="1" col_name="4" col_label="2" col_type="xs" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="freight_logistics_id" label="1" col_name="4" col_label="2" col_type="xs" />
|
||||
<field name="freight_logistics_phone" label="1" col_name="4" col_label="2" col_type="xs" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="freight_type" label="1" col_name="4" col_label="2" col_type="xs" />
|
||||
<field name="freight_sn" label="1" col_name="4" col_label="2" col_type="xs" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="freight_money" label="1" col_name="4" col_label="2" col_type="xs" />
|
||||
<field name="freight_pay_text" label="1" col_name="4" col_label="2" col_type="xs" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="freight_arrival_date" label="1" col_name="10" col_label="2" col_type="xs" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="freight_remark" label="1" col_name="10" col_label="2" col_type="xs" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="freight_created_by" read="1" label="1" col_name="4" col_label="2" col_type="xs" />
|
||||
<field name="freight_created_dt" read="1" label="1" col_name="4" col_label="2" col_type="xs" />
|
||||
</group>
|
||||
<field name="id" hidden="1" />
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$(function($) {
|
||||
$('#stock_delivery_freight_weight,#stock_delivery_freight_part_weight,#stock_delivery_freight_price').on('change', function(e) {
|
||||
var a = toNumber($('#stock_delivery_freight_weight').val());
|
||||
var b = toNumber($('#stock_delivery_freight_part_weight').val());
|
||||
var c = toNumber($('#stock_delivery_freight_price').val());
|
||||
var d = (a + b) * c;
|
||||
$('#stock_delivery_freight_short_money').val(d);
|
||||
});
|
||||
$('#stock_delivery_freight_money,#stock_delivery_freight_customer_money').on('change', function(e) {
|
||||
var a = toNumber($('#stock_delivery_freight_money').val());
|
||||
var b = toNumber($('#stock_delivery_freight_customer_money').val());
|
||||
var c = a - b;
|
||||
if (b > a) {
|
||||
c = 0;
|
||||
}
|
||||
$('#stock_delivery_freight_self_money').val(c);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</view>
|
||||
</gdoo>
|
||||
@@ -0,0 +1 @@
|
||||
{{$form['tpl']}}
|
||||
@@ -0,0 +1,203 @@
|
||||
<style type="text/css">
|
||||
@page {
|
||||
font:12pt 'SimSun', 'STXihei', sans-serif;
|
||||
margin: 10mm 5mm 15mm 5mm;
|
||||
size: 210mm 270mm;
|
||||
prince-pdf-page-colorspace: auto;
|
||||
prince-pdf-page-label: auto;
|
||||
prince-rotate-body: 0deg;
|
||||
prince-shrink-to-fit: none;
|
||||
@bottom {
|
||||
font-size: 10pt;
|
||||
content: "第" counter(page)"页,共"counter(pages)"页"
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<table class="table no-border">
|
||||
<tr>
|
||||
<td width="70%">客户名称:{{$master['tax_name']}}</td>
|
||||
<td width="30%">发货日期:{{$master['invoice_dt']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>运费付款方式:{{$master['freight_pay_text']}}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>联 系 人:{{$master['warehouse_contact']}}</td>
|
||||
<td>收货人手机:{{$master['warehouse_phone']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>收货地址:{{$master['warehouse_address']}}</td>
|
||||
<td>座机电话:{{$master['warehouse_tel']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>备注:{{$master['remark']}}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br><br>
|
||||
|
||||
<table class="table no-border">
|
||||
<tr>
|
||||
<td width="34%">产品</td>
|
||||
<td width="33%">库管员:</td>
|
||||
<td width="33%">发货员:</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php $products = $rows->where('product_type', '>', 0); ?>
|
||||
@if($products->count())
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td align="center">产品名称</td>
|
||||
<td align="center">规格型号</td>
|
||||
<td align="center">单位</td>
|
||||
<td align="center">数量</td>
|
||||
<td align="center">重量</td>
|
||||
<td align="center">备注</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($products as $row)
|
||||
<tr>
|
||||
<td align="center">
|
||||
{{$row['product_name']}}
|
||||
</td>
|
||||
<td align="center">
|
||||
{{$row['product_spec']}}
|
||||
</td>
|
||||
<td align="center">
|
||||
{{$row['product_unit']}}
|
||||
</td>
|
||||
<td align="right">
|
||||
@number($row['quantity'], 2)
|
||||
</td>
|
||||
<td align="right">
|
||||
@number($row['total_weight'], 2)
|
||||
</td>
|
||||
<td>
|
||||
{{$row['remark']}}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
<tr>
|
||||
<td align="center">合计</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td align="right">@number($products->sum('quantity'), 2)</td>
|
||||
<td align="right">@number((intval($products->sum('total_weight') / 100)) * 100, 2)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
@endif
|
||||
|
||||
<?php $materiels = $rows->where('material_type', '>', 0); ?>
|
||||
@if($materiels->count())
|
||||
<table class="table no-border">
|
||||
<tr>
|
||||
<td width="34%">物料</td>
|
||||
<td width="33%">库管员:</td>
|
||||
<td width="33%">发货员:</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td align="center">产品名称</td>
|
||||
<td align="center">规格型号</td>
|
||||
<td align="center">单位</td>
|
||||
<td align="center">数量</td>
|
||||
<td align="center">重量</td>
|
||||
<td align="center">备注</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($materiels as $row)
|
||||
<tr>
|
||||
<td align="center">
|
||||
{{$row['product_name']}}
|
||||
</td>
|
||||
<td align="center">
|
||||
{{$row['product_spec']}}
|
||||
</td>
|
||||
<td align="center">
|
||||
{{$row['product_unit']}}
|
||||
</td>
|
||||
<td align="right">
|
||||
{{$row['quantity']}}
|
||||
</td>
|
||||
<td align="right">
|
||||
@number($row['total_weight'], 2)
|
||||
</td>
|
||||
<td>
|
||||
{{$row['remark']}}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
<tr>
|
||||
<td align="center">合计</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td align="right">@number($materiels->sum('quantity'), 2)</td>
|
||||
<td align="right">@number($materiels->sum('total_weight'), 2)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
@endif
|
||||
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td width="10%">特别说明</td>
|
||||
<td width="90%">
|
||||
收货时请按我司《随货单》点货验收。货物如有缺失或者破损,请与承运方协调,采取现场赔付,如协调无法达成一致意见,请第一时间告知我司并向承运方索取有效货物异常证明(贵司收货人与承运方双方签字认可的货物运单)回单至我司028-38296888并确认收到。
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>回执单(客户填写)</td>
|
||||
<td><p style="padding-top:0;">
|
||||
1、
|
||||
年
|
||||
月
|
||||
日收到产品
|
||||
件,配件 件;
|
||||
</p>
|
||||
<p style="padding-top:0;">
|
||||
2、货品情况:<label class="checkbox-inline i-checks i-checks-sm"><i></i>完好</label>
|
||||
|
||||
<label class="checkbox-inline i-checks i-checks-sm"><i></i>缺失</label>
|
||||
|
||||
<label class="checkbox-inline i-checks i-checks-sm"><i></i>破损</label>
|
||||
</p>
|
||||
<p style="padding-top:0;">
|
||||
3、赔付与否:<label class="checkbox-inline i-checks i-checks-sm"><i></i>不需赔付</label>
|
||||
|
||||
<label class="checkbox-inline i-checks i-checks-sm"><i></i>需要赔付</label>
|
||||
</p>
|
||||
<p style="padding-top:0;">
|
||||
4、赔付要求:
|
||||
</p>
|
||||
<p style="padding-top:0;">
|
||||
您对我司此次配送服务是否满意:
|
||||
<label class="checkbox-inline i-checks i-checks-sm"><i></i>满意</label>
|
||||
|
||||
<label class="checkbox-inline i-checks i-checks-sm"><i></i>不满意</label>
|
||||
</p>
|
||||
<p style="padding-top:0;">
|
||||
贵司经办人签字(加盖贵司印章):
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">注:请您务必完整填写此表,签收时必须填写收到日期,否则视同在规定时间内已送达客户(此单回执,我司结账单以此单为准),谢谢合作!</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -0,0 +1,163 @@
|
||||
<div id="div1">
|
||||
<div style="line-height:40px;font-size:14pt;" align=center><strong><font>{{$setting['print_title']}}{{$form['template']['name']}}</font></strong></div>
|
||||
<table width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="70%">客户名称:{{$master['tax_name']}}</td>
|
||||
<td width="30%">发货日期:{{$master['invoice_dt']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>单据编号:{{$master['sn']}}</td>
|
||||
<td>销售类型:{{$master['type_name']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">备注:{{$master['remark']}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="div2">
|
||||
<style type="text/css">
|
||||
td { padding: 5px; }
|
||||
</style>
|
||||
<table width="100%" border="1" style="font-size:12pt;">
|
||||
<thead>
|
||||
<tr>
|
||||
<td align="center">产品名称</td>
|
||||
<td align="center">规格型号</td>
|
||||
<td align="center">单位</td>
|
||||
<td align="center">数量</td>
|
||||
<td align="center">备注</td>
|
||||
<td align="center">B</td>
|
||||
<td align="center">单价</td>
|
||||
<td align="center">金额</td>
|
||||
<td align="center">重量(kg)</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($rows as $row)
|
||||
<tr>
|
||||
<td align="center">
|
||||
{{$row['product_name']}}
|
||||
</td>
|
||||
<td align="center">
|
||||
{{$row['product_spec']}}
|
||||
</td>
|
||||
<td align="center">
|
||||
{{$row['product_unit']}}
|
||||
</td>
|
||||
<td align="center">
|
||||
<strong style="font-size:18px;">{{floatval($row['quantity'])}}</strong>
|
||||
</td>
|
||||
<td align="center">
|
||||
<strong style="font-size:18px;">{{$row['batch_sn']}}</strong>
|
||||
</td>
|
||||
<td align="center">
|
||||
{{$row['warehouse_type']}}
|
||||
</td>
|
||||
<td align="center">
|
||||
@number($row['price'], 2)
|
||||
</td>
|
||||
<td align="center">
|
||||
@number($row['money'], 2)
|
||||
</td>
|
||||
<td align="center">
|
||||
@number($row['total_weight'], 2)
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
@if($money < 0)
|
||||
<tr>
|
||||
<td align="center">折扣额</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td align="center">@number($money, 2)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
@endif
|
||||
|
||||
<tr>
|
||||
<td align="center">合计</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td align="center">{{floatval($rows->sum('quantity'))}}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td align="center"></td>
|
||||
<td align="center">@number($rows->sum('money') + $money, 2)</td>
|
||||
<td align="center">@number($rows->sum('total_weight'), 2)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="div3">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td width="25%">制单:{{$master['created_by']}}</td>
|
||||
<td width="25%">财务:李彩</td>
|
||||
<td width="25%">发货:</td>
|
||||
<td width="25%">仓管:</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="div4">
|
||||
<div align="center">第<font tdata="PageNO">##</font>页,<font tdata="PageCount">##</font></span>页</div>
|
||||
</div>
|
||||
|
||||
<script language="javascript" src="{{$asset_url}}/vendor/LodopFuncs.js"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
var LODOP;
|
||||
function print280() {
|
||||
LODOP = getLodop();
|
||||
LODOP.PRINT_INIT("{{$form['template']['name']}}");
|
||||
LODOP.SET_PRINT_PAGESIZE(0, 2100, 2700, "CreateCustomPage");
|
||||
|
||||
var strStyle = "<style> table,td,th {border-width:1px;border-style:solid;border-collapse:collapse}</style>";
|
||||
|
||||
LODOP.ADD_PRINT_TABLE(125, "4%", "92%", 400, strStyle + document.getElementById("div2").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"Vorient", 3);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, "4%", "92%", 120, document.getElementById("div1").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, 0, "92%", 54, document.getElementById("div3").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"LinkedItem", -2);
|
||||
|
||||
LODOP.ADD_PRINT_HTM('96%', "4%","92%", 22, document.getElementById("div4").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.PREVIEW();
|
||||
};
|
||||
|
||||
function print140() {
|
||||
LODOP = getLodop();
|
||||
LODOP.PRINT_INIT("{{$form['template']['name']}}");
|
||||
LODOP.SET_PRINT_PAGESIZE(0, 2100, 1400, "CreateCustomPage");
|
||||
|
||||
var strStyle = "<style> table,td,th {border-width:1px;border-style:solid;border-collapse:collapse}</style>";
|
||||
|
||||
LODOP.ADD_PRINT_TABLE(125, "4%", "92%", 410, strStyle + document.getElementById("div2").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"Vorient", 3);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, "4%", "92%", 120, document.getElementById("div1").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, 0, "92%", 54, document.getElementById("div3").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"LinkedItem", -2);
|
||||
|
||||
LODOP.ADD_PRINT_HTM('93%', "4%","92%", 22, document.getElementById("div4").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.PREVIEW();
|
||||
};
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,109 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<div class="wrapper-sm" style="padding-bottom:0;">
|
||||
<div id="dialog-promotion-toolbar">
|
||||
<form id="dialog-promotion-search-form" name="dialog_promotion_search_form" class="search-inline-form form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_promotion" class="ag-theme-balham" style="width:100%;height:140px;"></div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_promotion_data" class="ag-theme-balham" style="width:100%;height:240px;"></div>
|
||||
</div>
|
||||
<script>
|
||||
var $ref_promotion = null;
|
||||
var $ref_promotion_data = null;
|
||||
var params = JSON.parse('{{json_encode($query)}}');
|
||||
(function($) {
|
||||
params['master'] = 1;
|
||||
var mGridDiv = document.querySelector("#ref_promotion");
|
||||
var mGrid = new agGridOptions();
|
||||
mGrid.remoteDataUrl = '{{url()}}';
|
||||
mGrid.remoteParams = params;
|
||||
//mGrid.rowMultiSelectWithClick = true;
|
||||
mGrid.rowSelection = 'multiple';
|
||||
mGrid.autoColumnsToFit = false;
|
||||
mGrid.defaultColDef.suppressMenu = true;
|
||||
mGrid.defaultColDef.sortable = false;
|
||||
mGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'sn', headerName: '促销编号', minWidth: 160},
|
||||
{cellClass:'text-center', field: 'created_at', type: 'datetime', headerName: '单据日期', width: 120},
|
||||
{cellClass:'text-center', field: 'status', headerName: '状态', width: 160},
|
||||
{cellClass:'text-center', field: 'customer_code', headerName: '客户编码', width: 160},
|
||||
{field:'customer_name', headerName: '客户名称', width: 160},
|
||||
{field:'warehouse_contact', headerName: '收货人', width: 160},
|
||||
{field:'warehouse_phone', headerName: '收货人电话', width: 160},
|
||||
{field:'warehouse_address', headerName: '收货地址', width: 260},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
mGrid.onSelectionChanged = function() {
|
||||
var rows = mGrid.api.getSelectedRows();
|
||||
var ids = [];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
ids.push(rows[i].id);
|
||||
}
|
||||
params.promotion_ids = ids;
|
||||
sGrid.remoteData(params);
|
||||
};
|
||||
new agGrid.Grid(mGridDiv, mGrid);
|
||||
// 读取数据
|
||||
mGrid.remoteData();
|
||||
$ref_promotion = mGrid;
|
||||
|
||||
params['master'] = 0;
|
||||
var sGridDiv = document.querySelector("#ref_promotion_data");
|
||||
var sGrid = new agGridOptions();
|
||||
sGrid.remoteDataUrl = '{{url()}}';
|
||||
sGrid.remoteParams = params;
|
||||
//sGrid.rowMultiSelectWithClick = true;
|
||||
sGrid.rowSelection = 'multiple';
|
||||
sGrid.autoColumnsToFit = false;
|
||||
sGrid.defaultColDef.suppressMenu = true;
|
||||
sGrid.defaultColDef.sortable = false;
|
||||
sGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'product_code', headerName: '存货编码', width: 100},
|
||||
{field: 'product_name', headerName: '商品名称', minWidth: 180},
|
||||
{cellClass:'text-center', field: 'product_spec', headerName: '商品规格', width: 140},
|
||||
{cellClass:'text-center', field: 'unit_name', headerName: '计量单位', width: 80},
|
||||
{cellClass:'text-center', field: 'discount_rate', headerName: '现存量', width: 80},
|
||||
{cellClass:'text-right', field: 'total_quantity', headerName: '促销数量', width: 80},
|
||||
{cellClass:'text-right', field: 'use_quantity', headerName: '已发数量', width: 80},
|
||||
{cellClass:'text-right', field: 'quantity', headerName: '可用数量', width: 80},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
new agGrid.Grid(sGridDiv, sGrid);
|
||||
// 读取数据
|
||||
sGrid.remoteData();
|
||||
$ref_promotion_data = sGrid;
|
||||
|
||||
var data = JSON.parse('{{json_encode($search["forms"])}}');
|
||||
var search = $('#dialog-promotion-search-form').searchForm({
|
||||
data: data,
|
||||
init:function(e) {}
|
||||
});
|
||||
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var query = search.serializeArray();
|
||||
$.map(query, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
|
||||
params['master'] = 1;
|
||||
mGrid.remoteData(params);
|
||||
|
||||
params['master'] = 0;
|
||||
sGrid.remoteData(params);
|
||||
return false;
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,411 @@
|
||||
<div class="form-panel">
|
||||
<div class="form-panel-header">
|
||||
<div class="pull-right">
|
||||
</div>
|
||||
{{$form['btn']}}
|
||||
</div>
|
||||
<div class="form-panel-body panel-form-{{$form['action']}}">
|
||||
<form class="form-horizontal form-controller" method="post" id="{{$form['table']}}" name="{{$form['table']}}">
|
||||
{{$form['tpl']}}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var table = '{{$form["table"]}}';
|
||||
var grid = null;
|
||||
|
||||
(function ($) {
|
||||
|
||||
$('#stock_direct_data_tool').append('<a class="btn btn-sm btn-default" href="javascript:batchDistribute();">批次分配</a> <a class="btn btn-sm btn-default" href="javascript:importExcel();">导入</a>');
|
||||
|
||||
gdoo.event.set('stock_direct.invoice_dt', {
|
||||
onpicked() {
|
||||
var date = $('#stock_direct_invoice_dt').val();
|
||||
date = date.replace(/-/gi, '');
|
||||
$.post(app.url('index/api/billSeqNo'), {date: date, bill_id: 65}, function(res) {
|
||||
$('#stock_direct_sn').val(res.data);
|
||||
}, 'json');
|
||||
}
|
||||
});
|
||||
|
||||
// 发货记录
|
||||
function importExcel() {
|
||||
if (has_customer_id() == false) {
|
||||
return;
|
||||
}
|
||||
var url = app.url('stock/direct/importExcel');
|
||||
formDialog({
|
||||
title: '导入数据',
|
||||
url: url,
|
||||
id: 'import_excel',
|
||||
dialogClass:'modal-md',
|
||||
onSubmit: function() {
|
||||
var me = this;
|
||||
var form = $('#import_excel');
|
||||
var file = document.querySelector("#import_file").files[0];
|
||||
var formData = new FormData();
|
||||
formData.append('file', file);
|
||||
formData.append('customer_id', get_customer_id());
|
||||
var loading = layer.msg('数据提交中...', {
|
||||
icon: 16, shade: 0.1, time: 1000 * 120
|
||||
});
|
||||
$.ajax(url, {
|
||||
method: "post",
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
complete: function() {
|
||||
layer.close(loading);
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.status) {
|
||||
grid.api.setRowData([]);
|
||||
for (var i = 0; i < res.data.length; i++) {
|
||||
var row = res.data[i];
|
||||
grid.api.memoryStore.create(row);
|
||||
}
|
||||
grid.generatePinnedBottomData();
|
||||
$(me).dialog('close');
|
||||
toastrSuccess('导入数据成功。');
|
||||
} else {
|
||||
toastrError(res.data);
|
||||
}
|
||||
},
|
||||
error: function (res) {
|
||||
toastrError(res.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
window.importExcel = importExcel;
|
||||
|
||||
// 获取生产批号
|
||||
function getBatchSelect(warehouse_id, product_ids, batchs, fun) {
|
||||
$.post(app.url('stock/delivery/getBatchSelectZY'), {
|
||||
warehouse_id: warehouse_id,
|
||||
product_id: product_ids,
|
||||
value: batchs
|
||||
}, function(res) {
|
||||
fun(res);
|
||||
});
|
||||
}
|
||||
|
||||
// 分配批次
|
||||
function batchDistribute() {
|
||||
|
||||
if (has_warehouse_id() == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
var rows = [];
|
||||
var product_ids = {};
|
||||
|
||||
grid.api.stopEditing();
|
||||
grid.api.forEachNode(function (node) {
|
||||
var data = node.data;
|
||||
if (data.product_id > 0) {
|
||||
if (data.product_code == '99001') {
|
||||
return;
|
||||
}
|
||||
if (data.quantity > 0) {
|
||||
product_ids[data.product_id] = data.product_id;
|
||||
rows.push(data);
|
||||
} else {
|
||||
toastrError('请先填写数量:' + data.product_name + '('+data.product_code+')');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var warehouse_id = $('#stock_direct_warehouse_id').val();
|
||||
|
||||
var loading = layer.msg('数据提交中...', {
|
||||
icon: 16, shade: 0.1, time: 1000 * 120
|
||||
});
|
||||
|
||||
var product_ids = Object.keys(product_ids).join(',');
|
||||
getBatchSelect(warehouse_id, product_ids, '', function(res) {
|
||||
|
||||
var products = {};
|
||||
for (var i = 0; i < res.data.length; i++) {
|
||||
var data = res.data[i];
|
||||
var product = products['_' + data.product_id] || [];
|
||||
product.push(data);
|
||||
products['_' + data.product_id] = product;
|
||||
}
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
if (row.product_code == '99001') {
|
||||
continue;
|
||||
}
|
||||
var quantity = parseFloat(row.quantity);
|
||||
var ret = false;
|
||||
var insert = false;
|
||||
// 获取批次
|
||||
var batchs = products['_' + row.product_id] || [];
|
||||
|
||||
for (var j = 0; j < batchs.length; j++) {
|
||||
var batch = batchs[j];
|
||||
var ky_num = parseFloat(batch.ky_num);
|
||||
if (ky_num <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var item = jQuery.extend({}, row);
|
||||
item.warehouse_id = batch.warehouse_id;
|
||||
item.warehouse_id_name = batch.warehouse_name;
|
||||
item.batch_sn = batch.batch_sn;
|
||||
item.batch_date = batch.batch_date;
|
||||
item.poscode = batch.poscode;
|
||||
item.posname = batch.posname;
|
||||
|
||||
if (quantity > ky_num) {
|
||||
item.quantity = ky_num;
|
||||
quantity = quantity - ky_num;
|
||||
insert = true;
|
||||
} else {
|
||||
ret = true;
|
||||
item.quantity = quantity;
|
||||
}
|
||||
|
||||
// 减少批号可用量
|
||||
batch.ky_num = ky_num - item.quantity;
|
||||
|
||||
item.total_weight = item.quantity * item.weight;
|
||||
item.money = item.quantity * item.price;
|
||||
// 赠品
|
||||
if (item.type_id == 2) {
|
||||
item.other_money = item.money;
|
||||
}
|
||||
|
||||
if (j > 0 && insert == true) {
|
||||
grid.api.memoryStore.create(item);
|
||||
} else {
|
||||
grid.api.memoryStore.update(item);
|
||||
}
|
||||
|
||||
// 单个产品写入结束
|
||||
if (ret == true) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
layer.close(loading);
|
||||
grid.generatePinnedBottomData();
|
||||
});
|
||||
}
|
||||
window.batchDistribute = batchDistribute;
|
||||
|
||||
// grid初始化事件
|
||||
gdoo.event.set('grid.stock_direct_data', {
|
||||
ready(me) {
|
||||
grid = me;
|
||||
grid.dataKey = 'product_id';
|
||||
},
|
||||
onSaveBefore(rows) {
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
var quantity = toNumber(row.quantity);
|
||||
var price = toNumber(row.price);
|
||||
var money = toNumber(row.money).toFixed(2);
|
||||
var new_money = (quantity * price).toFixed(2);
|
||||
var other_money = toNumber(row.other_money).toFixed(2);
|
||||
|
||||
if (quantity > 0 && price > 0) {
|
||||
if (new_money != money) {
|
||||
toastrError(row.product_name + ' 数量 * 单价不等于金额');
|
||||
return false;
|
||||
}
|
||||
if (other_money > 0) {
|
||||
if (other_money != money) {
|
||||
toastrError(row.product_name + '其他金额不等于金额');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
editable: {
|
||||
product_name(params) {
|
||||
return has_customer_id();
|
||||
},
|
||||
batch_sn(params) {
|
||||
var row = params.data;
|
||||
if (row.product_id > 0) {
|
||||
} else {
|
||||
toastrError('请先选择产品');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
poscode(params) {
|
||||
return has_warehouse_id();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 选择产品
|
||||
gdoo.event.set('stock_direct_data.product_id', {
|
||||
open(params) {
|
||||
params.url = 'product/product/serviceCustomer';
|
||||
},
|
||||
query(query) {
|
||||
query.customer_id = get_customer_id();
|
||||
},
|
||||
onSelect(row, selected) {
|
||||
if (selected.code == '99001') {
|
||||
row.type_id_name = '费用';
|
||||
row.type_id = 5;
|
||||
} else {
|
||||
row.type_id_name = '普通';
|
||||
row.type_id = 1;
|
||||
row.price = selected.price;
|
||||
row.weight = selected.weight;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 选择客户事件
|
||||
gdoo.event.set('stock_direct.customer_id', {
|
||||
open(params) {
|
||||
},
|
||||
query(query) {
|
||||
},
|
||||
onSelect(row) {
|
||||
if (row.id) {
|
||||
$('#stock_direct_order_type_id').val(row.type_id);
|
||||
$('#stock_direct_order_type_id_select').val(row.type_id);
|
||||
|
||||
$('#stock_direct_warehouse_contact').val(row.warehouse_contact);
|
||||
$('#stock_direct_warehouse_phone').val(row.warehouse_phone);
|
||||
$('#stock_direct_warehouse_tel').val(row.warehouse_tel);
|
||||
$('#stock_direct_warehouse_address').val(row.warehouse_address);
|
||||
get_customer_tax(row.id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 选择生产批号
|
||||
gdoo.event.set('stock_direct_data.batch_sn', {
|
||||
open(params) {
|
||||
params.title = '选择库存现存量';
|
||||
params.url = 'stock/delivery/getBatchSelectZY';
|
||||
},
|
||||
query(query) {
|
||||
var warehouse_id = $('#stock_direct_warehouse_id').val();
|
||||
query.warehouse_id = warehouse_id;
|
||||
var row = grid.lastEditCell.data;
|
||||
if (row.product_id > 0) {
|
||||
query.product_id = row.product_id;
|
||||
}
|
||||
},
|
||||
onSelect(row, batch) {
|
||||
var quantity = parseFloat(row.quantity);
|
||||
var ky_num = parseFloat(batch.ky_num);
|
||||
quantity = quantity - ky_num;
|
||||
if (quantity > 0) {
|
||||
row.quantity = ky_num;
|
||||
}
|
||||
row.warehouse_id = batch.warehouse_id;
|
||||
row.warehouse_id_name = batch.warehouse_name;
|
||||
row.batch_sn = batch.batch_sn;
|
||||
row.batch_date = batch.batch_date;
|
||||
row.poscode = batch.poscode;
|
||||
row.posname = batch.posname;
|
||||
row.total_weight = row.quantity * row.weight;
|
||||
row.money = row.quantity * row.price;
|
||||
// 赠品
|
||||
if (row.type_id == 2) {
|
||||
row.other_money = row.money;
|
||||
}
|
||||
|
||||
// 库存现存量不足写入剩余数量
|
||||
if (quantity > 0) {
|
||||
var item = jQuery.extend({}, row);
|
||||
item.quantity = quantity;
|
||||
item.warehouse_id = 0;
|
||||
item.warehouse_id_name = '';
|
||||
item.batch_sn = '';
|
||||
item.batch_date = '';
|
||||
item.poscode = '';
|
||||
item.posname = '';
|
||||
item.total_weight = item.quantity * item.weight;
|
||||
item.money = item.quantity * item.price;
|
||||
// 赠品
|
||||
if (item.type_id == 2) {
|
||||
item.other_money = item.money;
|
||||
}
|
||||
grid.api.memoryStore.create(item);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 选择货位编号
|
||||
gdoo.event.set('stock_direct_data.poscode', {
|
||||
query(query) {
|
||||
var warehouse_id = get_warehouse_id();
|
||||
if (warehouse_id > 0) {
|
||||
query.warehouse_id = warehouse_id;
|
||||
}
|
||||
},
|
||||
onSelect(row, selectedRow) {
|
||||
row.poscode = selectedRow.code;
|
||||
row.posname = selectedRow.name;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
function get_warehouse_id() {
|
||||
var warehouse_id = $('#stock_direct_warehouse_id').val();
|
||||
return warehouse_id || 0;
|
||||
}
|
||||
|
||||
function has_warehouse_id() {
|
||||
var warehouse_id = get_warehouse_id();
|
||||
if (warehouse_id == 0) {
|
||||
toastrError('请先选择仓库');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function get_customer_id() {
|
||||
var customer_id = $('#stock_direct_customer_id').val();
|
||||
return customer_id || 0;
|
||||
}
|
||||
|
||||
function has_customer_id() {
|
||||
var customer_id = get_customer_id();
|
||||
if (customer_id == 0) {
|
||||
toastrError('请先选择客户');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
var tax_id = '{{$form["row"]["tax_id"]}}';
|
||||
function get_customer_tax(customer_id, tax_id) {
|
||||
if (customer_id) {
|
||||
$.post(app.url('customer/tax/dialog'), {customer_id: customer_id}, function (res) {
|
||||
var html = '<option value=""> - </option>';
|
||||
$.each(res.data, function (i, row) {
|
||||
var selected = tax_id == row.id ? 'selected="selected"' : '';
|
||||
html += '<option value="' + row.id + '" ' + selected + '>' + row.name + '</option>';
|
||||
});
|
||||
$('#stock_direct_tax_id').html(html);
|
||||
}, 'json');
|
||||
}
|
||||
}
|
||||
get_customer_tax(get_customer_id(), tax_id);
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,60 @@
|
||||
{{$header["js"]}}
|
||||
|
||||
<div class="panel no-border" id="{{$header['master_table']}}-controller">
|
||||
@include('headers')
|
||||
<div class='list-jqgrid'>
|
||||
<div id="{{$header['master_table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
var table = '{{$header["master_table"]}}';
|
||||
var config = gdoo.grids[table];
|
||||
var action = config.action;
|
||||
var search = config.search;
|
||||
|
||||
action.dialogType = 'layer';
|
||||
|
||||
// 自定义搜索方法
|
||||
search.searchInit = function (e) {
|
||||
var self = this;
|
||||
}
|
||||
|
||||
var options = new agGridOptions();
|
||||
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
|
||||
gridDiv.style.height = getPanelHeight(48);
|
||||
|
||||
options.remoteDataUrl = '{{url()}}';
|
||||
options.remoteParams = search.advanced.query;
|
||||
options.columnDefs = config.cols;
|
||||
options.autoColumnsToFit = false;
|
||||
options.onRowDoubleClicked = function (params) {
|
||||
if (params.node.rowPinned) {
|
||||
return;
|
||||
}
|
||||
if (params.data == undefined) {
|
||||
return;
|
||||
}
|
||||
if (params.data.master_id > 0) {
|
||||
action.show(params.data);
|
||||
}
|
||||
};
|
||||
|
||||
new agGrid.Grid(gridDiv, options);
|
||||
|
||||
// 读取数据
|
||||
options.remoteData({page: 1});
|
||||
|
||||
// 绑定自定义事件
|
||||
var $gridDiv = $(gridDiv);
|
||||
$gridDiv.on('click', '[data-toggle="event"]', function () {
|
||||
var data = $(this).data();
|
||||
if (data.master_id > 0) {
|
||||
action[data.action](data);
|
||||
}
|
||||
});
|
||||
config.grid = options;
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@include('footers')
|
||||
@@ -0,0 +1 @@
|
||||
{{$form['tpl']}}
|
||||
@@ -0,0 +1,163 @@
|
||||
<div id="div1">
|
||||
<div style="line-height:40px;font-size:14pt;" align=center><strong><font>{{$setting['print_title']}}发货单</font></strong></div>
|
||||
<table width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="70%">客户名称:{{$master['tax_name']}}</td>
|
||||
<td width="30%">发货日期:{{$master['invoice_dt']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>单据编号:{{$master['sn']}}</td>
|
||||
<td>销售类型:{{$master['type_name']}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">备注:{{$master['remark']}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="div2">
|
||||
<style type="text/css">
|
||||
td { padding: 5px; }
|
||||
</style>
|
||||
<table width="100%" border="1" style="font-size:12pt;">
|
||||
<thead>
|
||||
<tr>
|
||||
<td align="center">产品名称</td>
|
||||
<td align="center">规格型号</td>
|
||||
<td align="center">单位</td>
|
||||
<td align="center">数量</td>
|
||||
<td align="center">批次</td>
|
||||
<td align="center">B</td>
|
||||
<td align="center">单价</td>
|
||||
<td align="center">金额</td>
|
||||
<td align="center">重量(kg)</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($rows as $row)
|
||||
<tr>
|
||||
<td align="center">
|
||||
{{$row['product_name']}}
|
||||
</td>
|
||||
<td align="center">
|
||||
{{$row['product_spec']}}
|
||||
</td>
|
||||
<td align="center">
|
||||
{{$row['product_unit']}}
|
||||
</td>
|
||||
<td align="center">
|
||||
<strong style="font-size:18px;">{{floatval($row['quantity'])}}</strong>
|
||||
</td>
|
||||
<td align="center">
|
||||
<strong style="font-size:18px;">{{$row['batch_sn']}}</strong>
|
||||
</td>
|
||||
<td align="center">
|
||||
{{$row['warehouse_type']}}
|
||||
</td>
|
||||
<td align="center">
|
||||
@number($row['price'], 2)
|
||||
</td>
|
||||
<td align="center">
|
||||
@number($row['money'], 2)
|
||||
</td>
|
||||
<td align="center">
|
||||
@number($row['total_weight'], 2)
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
@if($money < 0)
|
||||
<tr>
|
||||
<td align="center">折扣额</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td align="center">@number($money, 2)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
@endif
|
||||
|
||||
<tr>
|
||||
<td align="center">合计</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td align="center">{{floatval($rows->sum('quantity'))}}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td align="center"></td>
|
||||
<td align="center">@number($rows->sum('money') + $money, 2)</td>
|
||||
<td align="center">@number($rows->sum('total_weight'), 2)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="div3">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td width="25%">制单:{{$master['created_by']}}</td>
|
||||
<td width="25%">财务:李彩</td>
|
||||
<td width="25%">发货:</td>
|
||||
<td width="25%">仓管:</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="div4">
|
||||
<div align="center">第<font tdata="PageNO">##</font>页,<font tdata="PageCount">##</font></span>页</div>
|
||||
</div>
|
||||
|
||||
<script language="javascript" src="{{$asset_url}}/vendor/LodopFuncs.js"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
var LODOP;
|
||||
function print280() {
|
||||
LODOP = getLodop();
|
||||
LODOP.PRINT_INIT("{{$form['template']['name']}}");
|
||||
LODOP.SET_PRINT_PAGESIZE(0, 2100, 2700, "CreateCustomPage");
|
||||
|
||||
var strStyle = "<style> table,td,th {border-width:1px;border-style:solid;border-collapse:collapse}</style>";
|
||||
|
||||
LODOP.ADD_PRINT_TABLE(125, "4%", "92%", 400, strStyle + document.getElementById("div2").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"Vorient", 3);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, "4%", "92%", 120, document.getElementById("div1").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, 0, "92%", 54, document.getElementById("div3").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"LinkedItem", -2);
|
||||
|
||||
LODOP.ADD_PRINT_HTM('96%', "4%","92%", 22, document.getElementById("div4").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.PREVIEW();
|
||||
};
|
||||
|
||||
function print140() {
|
||||
LODOP = getLodop();
|
||||
LODOP.PRINT_INIT("{{$form['template']['name']}}");
|
||||
LODOP.SET_PRINT_PAGESIZE(0, 2100, 1400, "CreateCustomPage");
|
||||
|
||||
var strStyle = "<style> table,td,th {border-width:1px;border-style:solid;border-collapse:collapse}</style>";
|
||||
|
||||
LODOP.ADD_PRINT_TABLE(125, "4%", "92%", 400, strStyle + document.getElementById("div2").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"Vorient", 3);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, "4%", "92%", 120, document.getElementById("div1").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
|
||||
|
||||
LODOP.ADD_PRINT_HTM(10, 0, "92%", 54, document.getElementById("div3").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"LinkedItem", -2);
|
||||
|
||||
LODOP.ADD_PRINT_HTM('93%', "4%","92%", 22, document.getElementById("div4").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.PREVIEW();
|
||||
};
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,109 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<div class="wrapper-sm" style="padding-bottom:0;">
|
||||
<div id="dialog-promotion-toolbar">
|
||||
<form id="dialog-promotion-search-form" name="dialog_promotion_search_form" class="search-inline-form form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_promotion" class="ag-theme-balham" style="width:100%;height:140px;"></div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_promotion_data" class="ag-theme-balham" style="width:100%;height:240px;"></div>
|
||||
</div>
|
||||
<script>
|
||||
var $ref_promotion = null;
|
||||
var $ref_promotion_data = null;
|
||||
var params = JSON.parse('{{json_encode($query)}}');
|
||||
(function($) {
|
||||
params['master'] = 1;
|
||||
var mGridDiv = document.querySelector("#ref_promotion");
|
||||
var mGrid = new agGridOptions();
|
||||
mGrid.remoteDataUrl = '{{url()}}';
|
||||
mGrid.remoteParams = params;
|
||||
mGrid.rowMultiSelectWithClick = false;
|
||||
mGrid.rowSelection = 'multiple';
|
||||
mGrid.autoColumnsToFit = false;
|
||||
mGrid.defaultColDef.suppressMenu = true;
|
||||
mGrid.defaultColDef.sortable = false;
|
||||
mGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'sn', headerName: '促销编号', minWidth: 160},
|
||||
{cellClass:'text-center', field: 'created_at', type: 'datetime', headerName: '单据日期', width: 120},
|
||||
{cellClass:'text-center', field: 'status', headerName: '状态', width: 160},
|
||||
{cellClass:'text-center', field: 'customer_code', headerName: '客户编码', width: 160},
|
||||
{field:'customer_name', headerName: '客户名称', width: 160},
|
||||
{field:'warehouse_contact', headerName: '收货人', width: 160},
|
||||
{field:'warehouse_phone', headerName: '收货人电话', width: 160},
|
||||
{field:'warehouse_address', headerName: '收货地址', width: 260},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
mGrid.onSelectionChanged = function() {
|
||||
var rows = mGrid.api.getSelectedRows();
|
||||
var ids = [];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
ids.push(rows[i].id);
|
||||
}
|
||||
params.promotion_ids = ids;
|
||||
sGrid.remoteData(params);
|
||||
};
|
||||
new agGrid.Grid(mGridDiv, mGrid);
|
||||
// 读取数据
|
||||
mGrid.remoteData();
|
||||
$ref_promotion = mGrid;
|
||||
|
||||
params['master'] = 0;
|
||||
var sGridDiv = document.querySelector("#ref_promotion_data");
|
||||
var sGrid = new agGridOptions();
|
||||
sGrid.remoteDataUrl = '{{url()}}';
|
||||
sGrid.remoteParams = params;
|
||||
sGrid.rowMultiSelectWithClick = true;
|
||||
sGrid.rowSelection = 'multiple';
|
||||
sGrid.autoColumnsToFit = false;
|
||||
sGrid.defaultColDef.suppressMenu = true;
|
||||
sGrid.defaultColDef.sortable = false;
|
||||
sGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'product_code', headerName: '存货编码', width: 100},
|
||||
{field: 'product_name', headerName: '商品名称', minWidth: 180},
|
||||
{cellClass:'text-center', field: 'product_spec', headerName: '商品规格', width: 140},
|
||||
{cellClass:'text-center', field: 'unit_name', headerName: '计量单位', width: 80},
|
||||
{cellClass:'text-center', field: 'discount_rate', headerName: '现存量', width: 80},
|
||||
{cellClass:'text-right', field: 'total_quantity', headerName: '促销数量', width: 80},
|
||||
{cellClass:'text-right', field: 'use_quantity', headerName: '已发数量', width: 80},
|
||||
{cellClass:'text-right', field: 'quantity', headerName: '可用数量', width: 80},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
new agGrid.Grid(sGridDiv, sGrid);
|
||||
// 读取数据
|
||||
sGrid.remoteData();
|
||||
$ref_promotion_data = sGrid;
|
||||
|
||||
var data = JSON.parse('{{json_encode($search["forms"])}}');
|
||||
var search = $('#dialog-promotion-search-form').searchForm({
|
||||
data: data,
|
||||
init:function(e) {}
|
||||
});
|
||||
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var query = search.serializeArray();
|
||||
$.map(query, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
|
||||
params['master'] = 1;
|
||||
mGrid.remoteData(params);
|
||||
|
||||
params['master'] = 0;
|
||||
sGrid.remoteData(params);
|
||||
return false;
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,3 @@
|
||||
<form class="form-horizontal form-controller" method="post" id="{{$form['table']}}" name="{{$form['table']}}">
|
||||
{{$form['tpl']}}
|
||||
</form>
|
||||
@@ -0,0 +1,122 @@
|
||||
<div class="wrapper-xs">
|
||||
<form id="dialog-{{$search['query']['id']}}-search-form" class="form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="dialog-{{$search['query']['id']}}" class="ag-theme-balham" style="width:100%;height:380px;"></div>
|
||||
|
||||
<script>
|
||||
(function ($) {
|
||||
var search = JSON.parse('{{json_encode($search)}}');
|
||||
var params = search.query;
|
||||
|
||||
var option = gdoo.formKey(params);
|
||||
var event = gdoo.event.get(option.key);
|
||||
event.trigger('query', params);
|
||||
|
||||
var sid = params.prefix == 1 ? 'sid' : 'id';
|
||||
var gridDiv = document.querySelector("#dialog-{{$search['query']['id']}}");
|
||||
var grid = new agGridOptions();
|
||||
var selectedData = {};
|
||||
var multiple = false;
|
||||
grid.remoteDataUrl = '{{url()}}';
|
||||
grid.remoteParams = params;
|
||||
grid.suppressRowClickSelection = true;
|
||||
grid.rowSelection = multiple ? 'multiple' : 'single';
|
||||
grid.columnDefs = [
|
||||
{suppressMenu: true, cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: multiple, suppressSizeToFit: true, sortable: false, width: 40},
|
||||
{suppressMenu: true, cellClass:'text-center', sortable: false, field: 'code', headerName: '编码', width: 60},
|
||||
{suppressMenu: true, cellClass:'text-left', sortable: false, field: 'name', headerName: '名称', minWidth: 160},
|
||||
{suppressMenu: true, cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
grid.onRowClicked = function(row) {
|
||||
var selected = row.node.isSelected();
|
||||
if (selected === false) {
|
||||
row.node.setSelected(true, true);
|
||||
}
|
||||
};
|
||||
|
||||
grid.onRowDoubleClicked = function (row) {
|
||||
var ret = writeSelected();
|
||||
if (ret == true) {
|
||||
$('#gdoo-dialog-' + params.dialog_index).dialog('close');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 初始化选择
|
||||
*/
|
||||
function initSelected() {
|
||||
if (params.is_grid) {
|
||||
} else {
|
||||
var rows = {};
|
||||
var id = $('#'+option.id).val();
|
||||
if (id) {
|
||||
var ids = id.split(',');
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
rows[ids[i]] = ids[i];
|
||||
}
|
||||
}
|
||||
grid.api.forEachNode(function(node) {
|
||||
var key = node.data[sid];
|
||||
if (rows[key] != undefined) {
|
||||
node.setSelected(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入选中
|
||||
*/
|
||||
function writeSelected() {
|
||||
var rows = grid.api.getSelectedRows();
|
||||
if (params.is_grid) {
|
||||
var list = gdoo.forms[params.form_id];
|
||||
list.api.dialogSelected(params);
|
||||
} else {
|
||||
var id = [];
|
||||
var text = [];
|
||||
$.each(rows, function(k, row) {
|
||||
id.push(row[sid]);
|
||||
text.push(row.name);
|
||||
});
|
||||
$('#'+option.id).val(id.join(','));
|
||||
$('#'+option.id+'_text').val(text.join(','));
|
||||
|
||||
if (event.exist('onSelect')) {
|
||||
return event.trigger('onSelect', multiple ? rows : rows[0]);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
grid.writeSelected = writeSelected;
|
||||
gdoo.dialogs[option.id] = grid;
|
||||
|
||||
new agGrid.Grid(gridDiv, grid);
|
||||
|
||||
// 读取数据
|
||||
grid.remoteData({page: 1});
|
||||
|
||||
// 数据载入成功
|
||||
grid.remoteSuccessed = function() {
|
||||
initSelected();
|
||||
}
|
||||
|
||||
var data = search.forms;
|
||||
var search = $("#dialog-{{$search['query']['id']}}-search-form").searchForm({
|
||||
data: data
|
||||
});
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var params = search.serializeArray();
|
||||
$.map(params, function(row) {
|
||||
data[row.name] = row.value;
|
||||
});
|
||||
grid.remoteData(data);
|
||||
return false;
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,122 @@
|
||||
<div class="wrapper-xs">
|
||||
<form id="dialog-{{$search['query']['id']}}-search-form" class="form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="dialog-{{$search['query']['id']}}" class="ag-theme-balham" style="width:100%;height:380px;"></div>
|
||||
|
||||
<script>
|
||||
(function ($) {
|
||||
var search = JSON.parse('{{json_encode($search)}}');
|
||||
var params = search.query;
|
||||
|
||||
var option = gdoo.formKey(params);
|
||||
var event = gdoo.event.get(option.key);
|
||||
event.trigger('query', params);
|
||||
|
||||
var sid = params.prefix == 1 ? 'sid' : 'id';
|
||||
var gridDiv = document.querySelector("#dialog-{{$search['query']['id']}}");
|
||||
var grid = new agGridOptions();
|
||||
var selectedData = {};
|
||||
var multiple = false;
|
||||
grid.remoteDataUrl = '{{url()}}';
|
||||
grid.remoteParams = params;
|
||||
grid.suppressRowClickSelection = true;
|
||||
grid.rowSelection = multiple ? 'multiple' : 'single';
|
||||
grid.columnDefs = [
|
||||
{suppressMenu: true, cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: multiple, suppressSizeToFit: true, sortable: false, width: 40},
|
||||
{suppressMenu: true, cellClass:'text-center', sortable: false, field: 'code', headerName: '编码', width: 60},
|
||||
{suppressMenu: true, cellClass:'text-left', sortable: false, field: 'name', headerName: '名称', minWidth: 160},
|
||||
{suppressMenu: true, cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
grid.onRowClicked = function(row) {
|
||||
var selected = row.node.isSelected();
|
||||
if (selected === false) {
|
||||
row.node.setSelected(true, true);
|
||||
}
|
||||
};
|
||||
|
||||
grid.onRowDoubleClicked = function (row) {
|
||||
var ret = writeSelected();
|
||||
if (ret == true) {
|
||||
$('#gdoo-dialog-' + params.dialog_index).dialog('close');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 初始化选择
|
||||
*/
|
||||
function initSelected() {
|
||||
if (params.is_grid) {
|
||||
} else {
|
||||
var rows = {};
|
||||
var id = $('#'+option.id).val();
|
||||
if (id) {
|
||||
var ids = id.split(',');
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
rows[ids[i]] = ids[i];
|
||||
}
|
||||
}
|
||||
grid.api.forEachNode(function(node) {
|
||||
var key = node.data[sid];
|
||||
if (rows[key] != undefined) {
|
||||
node.setSelected(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入选中
|
||||
*/
|
||||
function writeSelected() {
|
||||
var rows = grid.api.getSelectedRows();
|
||||
if (params.is_grid) {
|
||||
var list = gdoo.forms[params.form_id];
|
||||
list.api.dialogSelected(params);
|
||||
} else {
|
||||
var id = [];
|
||||
var text = [];
|
||||
$.each(rows, function(k, row) {
|
||||
id.push(row[sid]);
|
||||
text.push(row.name);
|
||||
});
|
||||
$('#'+option.id).val(id.join(','));
|
||||
$('#'+option.id+'_text').val(text.join(','));
|
||||
|
||||
if (event.exist('onSelect')) {
|
||||
return event.trigger('onSelect', multiple ? rows : rows[0]);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
grid.writeSelected = writeSelected;
|
||||
gdoo.dialogs[option.id] = grid;
|
||||
|
||||
new agGrid.Grid(gridDiv, grid);
|
||||
|
||||
// 读取数据
|
||||
grid.remoteData({page: 1});
|
||||
|
||||
// 数据载入成功
|
||||
grid.remoteSuccessed = function() {
|
||||
initSelected();
|
||||
}
|
||||
|
||||
var data = search.forms;
|
||||
var search = $("#dialog-{{$search['query']['id']}}-search-form").searchForm({
|
||||
data: data
|
||||
});
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var params = search.serializeArray();
|
||||
$.map(params, function(row) {
|
||||
data[row.name] = row.value;
|
||||
});
|
||||
grid.remoteData(data);
|
||||
return false;
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,57 @@
|
||||
{{$header["js"]}}
|
||||
|
||||
<div class="panel no-border" id="{{$header['table']}}-controller">
|
||||
@include('headers')
|
||||
<div class='list-jqgrid'>
|
||||
<div id="{{$header['table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
var table = '{{$header["table"]}}';
|
||||
var config = gdoo.grids[table];
|
||||
var action = config.action;
|
||||
var search = config.search;
|
||||
|
||||
// 自定义搜索方法
|
||||
search.searchInit = function (e) {
|
||||
var self = this;
|
||||
}
|
||||
|
||||
var options = new agGridOptions();
|
||||
var gridDiv = document.querySelector("#{{$header['table']}}-grid");
|
||||
gridDiv.style.height = getPanelHeight(48);
|
||||
|
||||
options.remoteDataUrl = '{{url()}}';
|
||||
options.remoteParams = search.advanced.query;
|
||||
options.columnDefs = config.cols;
|
||||
options.onRowDoubleClicked = function (params) {
|
||||
if (params.node.rowPinned) {
|
||||
return;
|
||||
}
|
||||
if (params.data == undefined) {
|
||||
return;
|
||||
}
|
||||
if (params.data.id > 0) {
|
||||
action.edit(params.data);
|
||||
}
|
||||
};
|
||||
|
||||
new agGrid.Grid(gridDiv, options);
|
||||
|
||||
// 读取数据
|
||||
options.remoteData({page: 1});
|
||||
|
||||
// 绑定自定义事件
|
||||
var $gridDiv = $(gridDiv);
|
||||
$gridDiv.on('click', '[data-toggle="event"]', function () {
|
||||
var data = $(this).data();
|
||||
if (data.master_id > 0) {
|
||||
action[data.action](data);
|
||||
}
|
||||
});
|
||||
config.grid = options;
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@include('footers')
|
||||
@@ -0,0 +1,130 @@
|
||||
<div class="form-panel">
|
||||
<div class="form-panel-header">
|
||||
<div class="pull-right">
|
||||
</div>
|
||||
{{$form['btn']}}
|
||||
|
||||
@if($form['action'] == 'show')
|
||||
@else
|
||||
<a href="javascript:orderDialog();" class="btn btn-sm btn-default">
|
||||
参照采购订单
|
||||
</a>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
<div class="form-panel-body panel-form-{{$form['action']}}">
|
||||
<form class="form-horizontal form-controller" method="post" id="{{$form['table']}}" name="{{$form['table']}}">
|
||||
{{$form['tpl']}}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var table = '{{$form["table"]}}';
|
||||
|
||||
// grid初始化事件
|
||||
gdoo.event.set('grid.stock_record01_data', {
|
||||
ready(me) {
|
||||
grid = me;
|
||||
grid.dataKey = 'product_id';
|
||||
},
|
||||
editable: {
|
||||
product_name(params) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function get_warehouse_id() {
|
||||
var warehouse_id = $('#stock_record01_warehouse_id').val();
|
||||
return warehouse_id || 0;
|
||||
}
|
||||
|
||||
function has_warehouse_id() {
|
||||
var warehouse_id = get_warehouse_id();
|
||||
if (warehouse_id == 0) {
|
||||
toastrError('请先选择仓库');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 子表对话框
|
||||
gdoo.event.set('stock_record01_data.product_id', {
|
||||
query(query) {
|
||||
},
|
||||
onSelect(row, selectedRow) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 选择客户事件
|
||||
gdoo.event.set('stock_record01.supplier_id', {
|
||||
onSelect(row) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
var orderDialog = function () {
|
||||
var buttons = [{
|
||||
text: "取消",
|
||||
'class': "btn-default",
|
||||
click: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}];
|
||||
buttons.push({
|
||||
text: '提交',
|
||||
'class': 'btn-info',
|
||||
click: function () {
|
||||
var master = $ref_purchase_order.api.getSelectedRows()[0];
|
||||
if (master) {
|
||||
|
||||
grid.api.forEachNode(function (node) {
|
||||
var data = node.data;
|
||||
if (isEmpty(data.product_id)) {
|
||||
grid.api.updateRowData({remove:[data]});
|
||||
}
|
||||
});
|
||||
|
||||
var supplier_ids = {};
|
||||
var rows = $ref_purchase_order_data.api.getSelectedRows();
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
supplier_ids[row.supplier_id] = row.supplier_id;
|
||||
}
|
||||
|
||||
if (Object.keys(supplier_ids).length == 1) {
|
||||
|
||||
// 写入主表信息
|
||||
$('#stock_record01_supplier_id').val(rows[0].supplier_id);
|
||||
$('#stock_record01_supplier_id_text').val(rows[0].supplier_name);
|
||||
$('#stock_record01_department_id').val(master.department_id);
|
||||
$('#stock_record01_department_id_text').val(master.department_name);
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
row.quantity = parseFloat(row.wr_num);
|
||||
grid.api.memoryStore.create(row);
|
||||
}
|
||||
grid.generatePinnedBottomData();
|
||||
$(this).dialog('close');
|
||||
} else {
|
||||
toastrError('采购入库供应商必须相同');
|
||||
}
|
||||
|
||||
} else {
|
||||
toastrError('采购订单主表记录没有选中');
|
||||
}
|
||||
}
|
||||
});
|
||||
$.dialog({
|
||||
title: '采购订单',
|
||||
url: '{{url("purchase/order/serviceRecord01")}}',
|
||||
dialogClass: 'modal-lg',
|
||||
buttons: buttons
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,59 @@
|
||||
{{$header["js"]}}
|
||||
|
||||
<div class="panel no-border" id="{{$header['master_table']}}-controller">
|
||||
@include('headers')
|
||||
<div class='list-jqgrid'>
|
||||
<div id="{{$header['master_table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
var table = '{{$header["master_table"]}}';
|
||||
var config = gdoo.grids[table];
|
||||
var action = config.action;
|
||||
var search = config.search;
|
||||
|
||||
action.dialogType = 'layer';
|
||||
|
||||
// 自定义搜索方法
|
||||
search.searchInit = function (e) {
|
||||
var self = this;
|
||||
}
|
||||
|
||||
var options = new agGridOptions();
|
||||
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
|
||||
gridDiv.style.height = getPanelHeight(48);
|
||||
|
||||
options.remoteDataUrl = '{{url()}}';
|
||||
options.remoteParams = search.advanced.query;
|
||||
options.columnDefs = config.cols;
|
||||
options.onRowDoubleClicked = function (params) {
|
||||
if (params.node.rowPinned) {
|
||||
return;
|
||||
}
|
||||
if (params.data == undefined) {
|
||||
return;
|
||||
}
|
||||
if (params.data.master_id > 0) {
|
||||
action.show(params.data);
|
||||
}
|
||||
};
|
||||
|
||||
new agGrid.Grid(gridDiv, options);
|
||||
|
||||
// 读取数据
|
||||
options.remoteData({page: 1});
|
||||
|
||||
// 绑定自定义事件
|
||||
var $gridDiv = $(gridDiv);
|
||||
$gridDiv.on('click', '[data-toggle="event"]', function () {
|
||||
var data = $(this).data();
|
||||
if (data.master_id > 0) {
|
||||
action[data.action](data);
|
||||
}
|
||||
});
|
||||
config.grid = options;
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@include('footers')
|
||||
@@ -0,0 +1 @@
|
||||
{{$form['tpl']}}
|
||||
@@ -0,0 +1,122 @@
|
||||
<div class="form-panel">
|
||||
<div class="form-panel-header">
|
||||
<div class="pull-right">
|
||||
</div>
|
||||
{{$form['btn']}}
|
||||
</div>
|
||||
<div class="form-panel-body panel-form-{{$form['action']}}">
|
||||
<form class="form-horizontal form-controller" method="post" id="{{$form['table']}}" name="{{$form['table']}}">
|
||||
{{$form['tpl']}}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var table = '{{$form["table"]}}';
|
||||
|
||||
$(function() {
|
||||
$('#stock_record08_data_tool').append('<a class="btn btn-sm btn-default" href="javascript:importExcel();">导入</a>');
|
||||
});
|
||||
|
||||
// 发货记录
|
||||
function importExcel() {
|
||||
var url = app.url('stock/record08/importExcel');
|
||||
formDialog({
|
||||
title: '导入数据',
|
||||
url: url,
|
||||
id: 'import_excel',
|
||||
dialogClass:'modal-md',
|
||||
onSubmit: function() {
|
||||
var me = this;
|
||||
var form = $('#import_excel');
|
||||
var file = document.querySelector("#import_file").files[0];
|
||||
var formData = new FormData();
|
||||
formData.append('file', file);
|
||||
var loading = layer.msg('数据提交中...', {
|
||||
icon: 16, shade: 0.1, time: 1000 * 120
|
||||
});
|
||||
$.ajax(url, {
|
||||
method: "post",
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
complete: function() {
|
||||
layer.close(loading);
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.status) {
|
||||
grid.api.setRowData([]);
|
||||
for (var i = 0; i < res.data.length; i++) {
|
||||
var row = res.data[i];
|
||||
grid.api.memoryStore.create(row);
|
||||
}
|
||||
$(me).dialog('close');
|
||||
toastrSuccess('导入数据成功。');
|
||||
} else {
|
||||
toastrError(res.data);
|
||||
}
|
||||
},
|
||||
error: function (res) {
|
||||
toastrError(res.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
window.importExcel = importExcel;
|
||||
|
||||
// grid初始化事件
|
||||
gdoo.event.set('grid.stock_record08_data',{
|
||||
ready(me) {
|
||||
grid = me;
|
||||
grid.dataKey = 'product_id';
|
||||
},
|
||||
editable: {
|
||||
product_name(params) {
|
||||
return has_warehouse_id();
|
||||
},
|
||||
poscode(params) {
|
||||
return has_warehouse_id();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function get_warehouse_id() {
|
||||
var warehouse_id = $('#stock_record08_warehouse_id').val();
|
||||
return warehouse_id || 0;
|
||||
}
|
||||
|
||||
function has_warehouse_id() {
|
||||
var warehouse_id = get_warehouse_id();
|
||||
if (warehouse_id == 0) {
|
||||
toastrError('请先选择仓库');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 子表对话框
|
||||
gdoo.event.set('stock_record08_data.product_id', {
|
||||
query(query) {
|
||||
},
|
||||
onSelect(row, selectedRow) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 选择货位编号
|
||||
gdoo.event.set('stock_record08_data.poscode', {
|
||||
query(query) {
|
||||
var warehouse_id = get_warehouse_id();
|
||||
if (warehouse_id > 0) {
|
||||
query.warehouse_id = warehouse_id;
|
||||
}
|
||||
},
|
||||
onSelect(row, selectedRow) {
|
||||
row.poscode = selectedRow.code;
|
||||
row.posname = selectedRow.name;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,59 @@
|
||||
{{$header["js"]}}
|
||||
|
||||
<div class="panel no-border" id="{{$header['master_table']}}-controller">
|
||||
@include('headers')
|
||||
<div class='list-jqgrid'>
|
||||
<div id="{{$header['master_table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
var table = '{{$header["master_table"]}}';
|
||||
var config = gdoo.grids[table];
|
||||
var action = config.action;
|
||||
var search = config.search;
|
||||
|
||||
action.dialogType = 'layer';
|
||||
|
||||
// 自定义搜索方法
|
||||
search.searchInit = function (e) {
|
||||
var self = this;
|
||||
}
|
||||
|
||||
var options = new agGridOptions();
|
||||
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
|
||||
gridDiv.style.height = getPanelHeight(48);
|
||||
|
||||
options.remoteDataUrl = '{{url()}}';
|
||||
options.remoteParams = search.advanced.query;
|
||||
options.columnDefs = config.cols;
|
||||
options.onRowDoubleClicked = function (params) {
|
||||
if (params.node.rowPinned) {
|
||||
return;
|
||||
}
|
||||
if (params.data == undefined) {
|
||||
return;
|
||||
}
|
||||
if (params.data.master_id > 0) {
|
||||
action.show(params.data);
|
||||
}
|
||||
};
|
||||
|
||||
new agGrid.Grid(gridDiv, options);
|
||||
|
||||
// 读取数据
|
||||
options.remoteData({page: 1});
|
||||
|
||||
// 绑定自定义事件
|
||||
var $gridDiv = $(gridDiv);
|
||||
$gridDiv.on('click', '[data-toggle="event"]', function () {
|
||||
var data = $(this).data();
|
||||
if (data.master_id > 0) {
|
||||
action[data.action](data);
|
||||
}
|
||||
});
|
||||
config.grid = options;
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@include('footers')
|
||||
@@ -0,0 +1 @@
|
||||
{{$form['tpl']}}
|
||||
@@ -0,0 +1,87 @@
|
||||
<div id="div1">
|
||||
<div style="line-height:40px;font-size:14pt;" align=center><strong><font>{{$setting['print_title']}}{{$form['template']['name']}}</font></strong></div>
|
||||
<table border=0 cellspacing=0 cellpadding=0 width="100%" style="font-size:11pt;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="43%"><font>单据编号:<span>{{$master['sn']}}</span></font></td>
|
||||
<td width="33%"><font>入库日期:<span>{{$master['invoice_dt']}}</span></font></td>
|
||||
<td><font>仓库:{{$master['warehouse_name']}}</font></td></tr>
|
||||
<tr>
|
||||
<td><font>入库类别:<span>{{$master['type_name']}}</span></font></td>
|
||||
<td><font>部门:<span>{{$master['department_name']}}</span></font><font></font></td>
|
||||
<td><font>备注:{{$master['remark']}}</font></td></tr>
|
||||
</tbody></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="div2">
|
||||
<style>
|
||||
td { padding: 2px; }
|
||||
</style>
|
||||
<table style="font-size:11pt;" border="1" width="100%" cellspacing="0" cellpadding="0" style="border-collapse:collapse" bordercolor="#000000">
|
||||
<tr>
|
||||
<td align="center">产品编码</td>
|
||||
<td align="center">产品名称</td>
|
||||
<td align="center">规格型号</td>
|
||||
<td align="center">单位</td>
|
||||
<td align="center">数量</td>
|
||||
<td align="center">批号</td>
|
||||
<td align="center">货位</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@foreach($rows as $row)
|
||||
<tr>
|
||||
<td align="center">{{$row['product_code']}}</td>
|
||||
<td align="center">{{$row['product_name']}}</td>
|
||||
<td align="center">{{$row['product_spec']}}</td>
|
||||
<td align="center">{{$row['product_unit']}}</td>
|
||||
<td align="right">@number($row['quantity'], 2)</td>
|
||||
<td align="center">{{$row['batch_sn']}}</td>
|
||||
<td align="center">{{$row['posname']}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
<tfoot>
|
||||
<td align="center">合计</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td tdata="Sum" format="#,##0.00" align="right"><font id="id01">###</font></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="div3">
|
||||
<table width="100%" style="LINE-HEIGHT:30px;font-size:11pt;" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
|
||||
<tr>
|
||||
<td width="40%">制单人:{{auth()->user()->name}}</td>
|
||||
<td width="40%">交货人:</td>
|
||||
<td width="20%" align="right">第<font tdata="PageNO">##</font>页,<font tdata="PageCount">##</font></span>页</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script language="javascript" src="{{$asset_url}}/vendor/LodopFuncs.js"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
var LODOP;
|
||||
function PrintMytable() {
|
||||
LODOP = getLodop();
|
||||
|
||||
LODOP.PRINT_INIT("{{$form['template']['name']}}");
|
||||
LODOP.SET_PRINT_PAGESIZE(0, 2100, 930, "CreateCustomPage");
|
||||
var strStyle="<style> table,td,th {border-width:1px;border-style:solid;border-collapse:collapse}</style>"
|
||||
LODOP.ADD_PRINT_TABLE(75, "6%", "88%", 475, strStyle + document.getElementById("div2").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"Vorient", 3);
|
||||
LODOP.ADD_PRINT_HTM(0, "6%", "88%", 109, document.getElementById("div1").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
|
||||
LODOP.ADD_PRINT_HTM(555, "6%","88%", 54, document.getElementById("div3").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0,"LinkedItem", 1);
|
||||
LODOP.PREVIEW();
|
||||
};
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,109 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<div class="wrapper-sm" style="padding-bottom:0;">
|
||||
<div id="dialog-promotion-toolbar">
|
||||
<form id="dialog-promotion-search-form" name="dialog_promotion_search_form" class="search-inline-form form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_promotion" class="ag-theme-balham" style="width:100%;height:140px;"></div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_promotion_data" class="ag-theme-balham" style="width:100%;height:240px;"></div>
|
||||
</div>
|
||||
<script>
|
||||
var $ref_promotion = null;
|
||||
var $ref_promotion_data = null;
|
||||
var params = JSON.parse('{{json_encode($query)}}');
|
||||
(function($) {
|
||||
params['master'] = 1;
|
||||
var mGridDiv = document.querySelector("#ref_promotion");
|
||||
var mGrid = new agGridOptions();
|
||||
mGrid.remoteDataUrl = '{{url()}}';
|
||||
mGrid.remoteParams = params;
|
||||
//mGrid.rowMultiSelectWithClick = true;
|
||||
mGrid.rowSelection = 'multiple';
|
||||
mGrid.autoColumnsToFit = false;
|
||||
mGrid.defaultColDef.suppressMenu = true;
|
||||
mGrid.defaultColDef.sortable = false;
|
||||
mGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'sn', headerName: '促销编号', minWidth: 160},
|
||||
{cellClass:'text-center', field: 'created_at', type: 'datetime', headerName: '单据日期', width: 120},
|
||||
{cellClass:'text-center', field: 'status', headerName: '状态', width: 160},
|
||||
{cellClass:'text-center', field: 'customer_code', headerName: '客户编码', width: 160},
|
||||
{field:'customer_name', headerName: '客户名称', width: 160},
|
||||
{field:'warehouse_contact', headerName: '收货人', width: 160},
|
||||
{field:'warehouse_phone', headerName: '收货人电话', width: 160},
|
||||
{field:'warehouse_address', headerName: '收货地址', width: 260},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
mGrid.onSelectionChanged = function() {
|
||||
var rows = mGrid.api.getSelectedRows();
|
||||
var ids = [];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
ids.push(rows[i].id);
|
||||
}
|
||||
params.promotion_ids = ids;
|
||||
sGrid.remoteData(params);
|
||||
};
|
||||
new agGrid.Grid(mGridDiv, mGrid);
|
||||
// 读取数据
|
||||
mGrid.remoteData();
|
||||
$ref_promotion = mGrid;
|
||||
|
||||
params['master'] = 0;
|
||||
var sGridDiv = document.querySelector("#ref_promotion_data");
|
||||
var sGrid = new agGridOptions();
|
||||
sGrid.remoteDataUrl = '{{url()}}';
|
||||
sGrid.remoteParams = params;
|
||||
//sGrid.rowMultiSelectWithClick = true;
|
||||
sGrid.rowSelection = 'multiple';
|
||||
sGrid.autoColumnsToFit = false;
|
||||
sGrid.defaultColDef.suppressMenu = true;
|
||||
sGrid.defaultColDef.sortable = false;
|
||||
sGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'product_code', headerName: '存货编码', width: 100},
|
||||
{field: 'product_name', headerName: '商品名称', minWidth: 180},
|
||||
{cellClass:'text-center', field: 'product_spec', headerName: '商品规格', width: 140},
|
||||
{cellClass:'text-center', field: 'unit_name', headerName: '计量单位', width: 80},
|
||||
{cellClass:'text-center', field: 'discount_rate', headerName: '现存量', width: 80},
|
||||
{cellClass:'text-right', field: 'total_quantity', headerName: '促销数量', width: 80},
|
||||
{cellClass:'text-right', field: 'use_quantity', headerName: '已发数量', width: 80},
|
||||
{cellClass:'text-right', field: 'quantity', headerName: '可用数量', width: 80},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
new agGrid.Grid(sGridDiv, sGrid);
|
||||
// 读取数据
|
||||
sGrid.remoteData();
|
||||
$ref_promotion_data = sGrid;
|
||||
|
||||
var data = JSON.parse('{{json_encode($search["forms"])}}');
|
||||
var search = $('#dialog-promotion-search-form').searchForm({
|
||||
data: data,
|
||||
init:function(e) {}
|
||||
});
|
||||
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var query = search.serializeArray();
|
||||
$.map(query, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
|
||||
params['master'] = 1;
|
||||
mGrid.remoteData(params);
|
||||
|
||||
params['master'] = 0;
|
||||
sGrid.remoteData(params);
|
||||
return false;
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,295 @@
|
||||
<div class="form-panel">
|
||||
<div class="form-panel-header">
|
||||
<div class="pull-right">
|
||||
</div>
|
||||
{{$form['btn']}}
|
||||
|
||||
@if($form['action'] == 'show')
|
||||
@else
|
||||
<a href="javascript:sampleDialog();" class="btn btn-sm btn-default">
|
||||
参照样品申请单
|
||||
</a>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
<div class="form-panel-body panel-form-{{$form['action']}}">
|
||||
<form class="form-horizontal form-controller" method="post" id="{{$form['table']}}" name="{{$form['table']}}">
|
||||
{{$form['tpl']}}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var table = '{{$form["table"]}}';
|
||||
|
||||
$(function() {
|
||||
$('#stock_record09_data_tool').append('<a class="btn btn-sm btn-default" href="javascript:stockSelect();">选择库存</a>');
|
||||
});
|
||||
|
||||
// grid初始化事件
|
||||
gdoo.event.set('grid.stock_record09_data', {
|
||||
ready(me) {
|
||||
grid = me;
|
||||
grid.dataKey = 'product_id';
|
||||
},
|
||||
editable: {
|
||||
product_name(params) {
|
||||
return has_warehouse_id();
|
||||
},
|
||||
batch_sn(params) {
|
||||
var row = params.data;
|
||||
if (row.product_id > 0) {
|
||||
} else {
|
||||
toastrError('请先选择产品');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
poscode(params) {
|
||||
var row = params.data;
|
||||
if (row.product_id > 0) {
|
||||
} else {
|
||||
toastrError('请先选择产品');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 选择生产批号
|
||||
gdoo.event.set('stock_record09_data.batch_sn', {
|
||||
open(params) {
|
||||
params.title = '选择库存现存量';
|
||||
params.url = 'stock/delivery/getBatchSelectAll';
|
||||
},
|
||||
query(query) {
|
||||
query.warehouse_id = get_warehouse_id();
|
||||
var row = grid.lastEditCell.data;
|
||||
if (row.product_id > 0) {
|
||||
query.product_id = row.product_id;
|
||||
}
|
||||
},
|
||||
onSelect(row, batch) {
|
||||
var quantity = parseFloat(row.quantity);
|
||||
var ky_num = parseFloat(batch.ky_num);
|
||||
quantity = quantity - ky_num;
|
||||
if (quantity > 0) {
|
||||
row.quantity = ky_num;
|
||||
}
|
||||
|
||||
row.batch_sn = batch.batch_sn;
|
||||
row.batch_date = batch.batch_date;
|
||||
|
||||
row.poscode = batch.poscode;
|
||||
row.posname = batch.posname;
|
||||
row.total_weight = row.quantity * row.weight;
|
||||
row.money = row.quantity * row.price;
|
||||
// 库存现存量不足写入剩余数量
|
||||
if (quantity > 0) {
|
||||
var item = jQuery.extend({}, row);
|
||||
item.quantity = quantity;
|
||||
|
||||
item.batch_sn = '';
|
||||
item.batch_date = '';
|
||||
|
||||
item.poscode = '';
|
||||
item.posname = '';
|
||||
|
||||
item.total_weight = item.quantity * item.weight;
|
||||
item.money = item.quantity * item.price;
|
||||
grid.api.memoryStore.create(item);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 子表对话框
|
||||
gdoo.event.set('stock_record09_data.product_id', {
|
||||
query(query) {
|
||||
},
|
||||
onSelect(row, selectedRow) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 选择货位编号
|
||||
gdoo.event.set('stock_record09_data.poscode', {
|
||||
query(query) {
|
||||
var warehouse_id = get_warehouse_id();
|
||||
if (warehouse_id > 0) {
|
||||
query.warehouse_id = warehouse_id;
|
||||
}
|
||||
},
|
||||
onSelect(row, selectedRow) {
|
||||
row.poscode = selectedRow.code;
|
||||
row.posname = selectedRow.name;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
function get_warehouse_id() {
|
||||
var customer_id = $('#stock_record09_warehouse_id').val();
|
||||
return customer_id || 0;
|
||||
}
|
||||
|
||||
function has_warehouse_id() {
|
||||
var warehouse_id = get_warehouse_id();
|
||||
if (warehouse_id == 0) {
|
||||
toastrError('请先选择仓库');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取生产批号
|
||||
function getBatchSelect(warehouse_id, product_id) {
|
||||
var ret = [];
|
||||
$.ajax({
|
||||
url:app.url('stock/delivery/getBatchSelectAll'),
|
||||
type: 'POST',
|
||||
data: {
|
||||
warehouse_id: warehouse_id,
|
||||
product_id: product_id
|
||||
},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function (res) {
|
||||
ret = res.data;
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
|
||||
// 选择库存
|
||||
function stockSelect() {
|
||||
if (has_warehouse_id() == false) {
|
||||
return;
|
||||
}
|
||||
var buttons = [{
|
||||
text: "取消",
|
||||
'class': "btn-default",
|
||||
click: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}];
|
||||
buttons.push({
|
||||
text: '提交',
|
||||
'class': 'btn-info',
|
||||
click: function () {
|
||||
var rows = $ref_stock_select.getSelectedRows();
|
||||
stockRowsSelected(rows);
|
||||
$(this).dialog('close');
|
||||
}
|
||||
});
|
||||
var warehouse_id = get_warehouse_id();
|
||||
$.dialog({
|
||||
title: '选择库存',
|
||||
url: '{{url("stock/allocation/stockSelect")}}?warehouse_id=' + warehouse_id,
|
||||
dialogClass: 'modal-lg',
|
||||
buttons: buttons
|
||||
});
|
||||
}
|
||||
window.stockSelect = stockSelect;
|
||||
|
||||
// 库存写入
|
||||
var stockRowsSelected = function(rows) {
|
||||
if (rows.length == 0) {
|
||||
return;
|
||||
}
|
||||
grid.api.forEachNode(function (node) {
|
||||
var data = node.data;
|
||||
if (isEmpty(data.product_id)) {
|
||||
grid.api.updateRowData({remove:[data]});
|
||||
}
|
||||
});
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
row.quantity = parseFloat(row.ky_num);
|
||||
row.total_weight = row.quantity * row.weight;
|
||||
row.money = row.quantity * row.price;
|
||||
grid.api.memoryStore.create(row);
|
||||
}
|
||||
grid.generatePinnedBottomData();
|
||||
return true;
|
||||
};
|
||||
window.stockRowsSelected = stockRowsSelected;
|
||||
|
||||
var sampleDialog = function () {
|
||||
var buttons = [{
|
||||
text: "取消",
|
||||
'class': "btn-default",
|
||||
click: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}];
|
||||
buttons.push({
|
||||
text: '提交',
|
||||
'class': 'btn-info',
|
||||
click: function () {
|
||||
var row = $ref_sample_apply.api.getSelectedRows()[0];
|
||||
if (row) {
|
||||
$('#stock_record09_department_id').val(row.department_id);
|
||||
$('#stock_record09_department_id_text').val(row.department_name);
|
||||
$('#stock_record09_type_id').val(2);
|
||||
}
|
||||
grid.api.forEachNode(function (node) {
|
||||
var data = node.data;
|
||||
if (isEmpty(data.product_id)) {
|
||||
grid.api.updateRowData({remove:[data]});
|
||||
}
|
||||
});
|
||||
|
||||
var loading = layer.msg('数据提交中...', {
|
||||
icon: 16, shade: 0.1, time: 1000 * 120
|
||||
});
|
||||
var warehouse_id = $('#stock_record09_warehouse_id').val();
|
||||
var rows = $ref_sample_apply_data.api.getSelectedRows();
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
// 产品库存不足
|
||||
if (row.ky_num <= 0) {
|
||||
continue;
|
||||
}
|
||||
var quantity = parseFloat(row.wc_num);
|
||||
var batchs = getBatchSelect(warehouse_id, row.product_id);
|
||||
var ret = false;
|
||||
for (var j = 0; j < batchs.length; j++) {
|
||||
console.log(batch);
|
||||
var batch = batchs[j];
|
||||
var ky_num = parseFloat(batch.ky_num);
|
||||
var item = jQuery.extend({}, row);
|
||||
if (quantity > ky_num) {
|
||||
item.quantity = ky_num;
|
||||
quantity = quantity - ky_num;
|
||||
} else {
|
||||
ret = true;
|
||||
item.quantity = quantity;
|
||||
}
|
||||
item.batch_sn = batch.batch_sn;
|
||||
item.batch_date = batch.batch_date;
|
||||
item.poscode = batch.poscode;
|
||||
item.posname = batch.posname;
|
||||
grid.api.memoryStore.create(item);
|
||||
// 单个产品写入结束
|
||||
if (ret == true) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
layer.close(loading);
|
||||
grid.generatePinnedBottomData();
|
||||
$(this).dialog('close');
|
||||
}
|
||||
});
|
||||
$.dialog({
|
||||
title: '样品申请单',
|
||||
url: '{{url("order/sample-apply/serviceDelivery")}}',
|
||||
dialogClass: 'modal-lg',
|
||||
buttons: buttons
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,59 @@
|
||||
{{$header["js"]}}
|
||||
|
||||
<div class="panel no-border" id="{{$header['master_table']}}-controller">
|
||||
@include('headers')
|
||||
<div class='list-jqgrid'>
|
||||
<div id="{{$header['master_table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
var table = '{{$header["master_table"]}}';
|
||||
var config = gdoo.grids[table];
|
||||
var action = config.action;
|
||||
var search = config.search;
|
||||
|
||||
action.dialogType = 'layer';
|
||||
|
||||
// 自定义搜索方法
|
||||
search.searchInit = function (e) {
|
||||
var self = this;
|
||||
}
|
||||
|
||||
var options = new agGridOptions();
|
||||
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
|
||||
gridDiv.style.height = getPanelHeight(48);
|
||||
|
||||
options.remoteDataUrl = '{{url()}}';
|
||||
options.remoteParams = search.advanced.query;
|
||||
options.columnDefs = config.cols;
|
||||
options.onRowDoubleClicked = function (params) {
|
||||
if (params.node.rowPinned) {
|
||||
return;
|
||||
}
|
||||
if (params.data == undefined) {
|
||||
return;
|
||||
}
|
||||
if (params.data.master_id > 0) {
|
||||
action.show(params.data);
|
||||
}
|
||||
};
|
||||
|
||||
new agGrid.Grid(gridDiv, options);
|
||||
|
||||
// 读取数据
|
||||
options.remoteData({page: 1});
|
||||
|
||||
// 绑定自定义事件
|
||||
var $gridDiv = $(gridDiv);
|
||||
$gridDiv.on('click', '[data-toggle="event"]', function () {
|
||||
var data = $(this).data();
|
||||
if (data.master_id > 0) {
|
||||
action[data.action](data);
|
||||
}
|
||||
});
|
||||
config.grid = options;
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@include('footers')
|
||||
@@ -0,0 +1 @@
|
||||
{{$form['tpl']}}
|
||||
@@ -0,0 +1,87 @@
|
||||
<div id="div1">
|
||||
<div style="line-height:40px;font-size:14pt;" align=center><strong><font>{{$setting['print_title']}}{{$form['template']['name']}}</font></strong></div>
|
||||
<table border=0 cellspacing=0 cellpadding=0 width="100%" style="font-size:11pt;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="43%"><font>单据编号:<span>{{$master['sn']}}</span></font></td>
|
||||
<td width="33%"><font>出库日期:<span>{{$master['invoice_dt']}}</span></font></td>
|
||||
<td><font>仓库:{{$master['warehouse_name']}}</font></td></tr>
|
||||
<tr>
|
||||
<td><font>出库类别:<span>{{$master['type_name']}}</span></font></td>
|
||||
<td><font>部门:<span>{{$master['department_name']}}</span></font><font></font></td>
|
||||
<td><font>备注:{{$master['remark']}}</font></td></tr>
|
||||
</tbody></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="div2">
|
||||
<style>
|
||||
td { padding: 2px; }
|
||||
</style>
|
||||
<table style="font-size:11pt;" border="1" width="100%" cellspacing="0" cellpadding="0" style="border-collapse:collapse" bordercolor="#000000">
|
||||
<tr>
|
||||
<td align="center">产品编码</td>
|
||||
<td align="center">产品名称</td>
|
||||
<td align="center">规格型号</td>
|
||||
<td align="center">单位</td>
|
||||
<td align="center">数量</td>
|
||||
<td align="center">批号</td>
|
||||
<td align="center">货位</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@foreach($rows as $row)
|
||||
<tr>
|
||||
<td align="center">{{$row['product_code']}}</td>
|
||||
<td align="center">{{$row['product_name']}}</td>
|
||||
<td align="center">{{$row['product_spec']}}</td>
|
||||
<td align="center">{{$row['product_unit']}}</td>
|
||||
<td align="right">@number($row['quantity'], 2)</td>
|
||||
<td align="center">{{$row['batch_sn']}}</td>
|
||||
<td align="center">{{$row['posname']}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
<tfoot>
|
||||
<td align="center">合计</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td tdata="Sum" format="#,##0.00" align="right"><font id="id01">###</font></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="div3">
|
||||
<table width="100%" style="LINE-HEIGHT:30px;font-size:11pt;" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
|
||||
<tr>
|
||||
<td width="40%">制单人:{{$master['created_by']}}</td>
|
||||
<td width="40%">收货人:</td>
|
||||
<td width="20%" align="right">第<font tdata="PageNO">##</font>页,<font tdata="PageCount">##</font></span>页</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script language="javascript" src="{{$asset_url}}/vendor/LodopFuncs.js"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
var LODOP;
|
||||
function print93() {
|
||||
LODOP = getLodop();
|
||||
|
||||
LODOP.PRINT_INIT("{{$form['template']['name']}}");
|
||||
LODOP.SET_PRINT_PAGESIZE(0, 2100, 930, "CreateCustomPage");
|
||||
var strStyle="<style> table,td,th {border-width:1px;border-style:solid;border-collapse:collapse}</style>"
|
||||
LODOP.ADD_PRINT_TABLE(75, "4%", "92%", 475, strStyle + document.getElementById("div2").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"Vorient", 3);
|
||||
LODOP.ADD_PRINT_HTM(0, "4%", "92%", 109, document.getElementById("div1").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
|
||||
LODOP.ADD_PRINT_HTM(555, "4%","92%", 54, document.getElementById("div3").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0,"LinkedItem", 1);
|
||||
LODOP.PREVIEW();
|
||||
};
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,109 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<div class="wrapper-sm" style="padding-bottom:0;">
|
||||
<div id="dialog-promotion-toolbar">
|
||||
<form id="dialog-promotion-search-form" name="dialog_promotion_search_form" class="search-inline-form form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_promotion" class="ag-theme-balham" style="width:100%;height:140px;"></div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_promotion_data" class="ag-theme-balham" style="width:100%;height:240px;"></div>
|
||||
</div>
|
||||
<script>
|
||||
var $ref_promotion = null;
|
||||
var $ref_promotion_data = null;
|
||||
var params = JSON.parse('{{json_encode($query)}}');
|
||||
(function($) {
|
||||
params['master'] = 1;
|
||||
var mGridDiv = document.querySelector("#ref_promotion");
|
||||
var mGrid = new agGridOptions();
|
||||
mGrid.remoteDataUrl = '{{url()}}';
|
||||
mGrid.remoteParams = params;
|
||||
//mGrid.rowMultiSelectWithClick = true;
|
||||
mGrid.rowSelection = 'multiple';
|
||||
mGrid.autoColumnsToFit = false;
|
||||
mGrid.defaultColDef.suppressMenu = true;
|
||||
mGrid.defaultColDef.sortable = false;
|
||||
mGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'sn', headerName: '促销编号', minWidth: 160},
|
||||
{cellClass:'text-center', field: 'created_at', type: 'datetime', headerName: '单据日期', width: 120},
|
||||
{cellClass:'text-center', field: 'status', headerName: '状态', width: 160},
|
||||
{cellClass:'text-center', field: 'customer_code', headerName: '客户编码', width: 160},
|
||||
{field:'customer_name', headerName: '客户名称', width: 160},
|
||||
{field:'warehouse_contact', headerName: '收货人', width: 160},
|
||||
{field:'warehouse_phone', headerName: '收货人电话', width: 160},
|
||||
{field:'warehouse_address', headerName: '收货地址', width: 260},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
mGrid.onSelectionChanged = function() {
|
||||
var rows = mGrid.api.getSelectedRows();
|
||||
var ids = [];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
ids.push(rows[i].id);
|
||||
}
|
||||
params.promotion_ids = ids;
|
||||
sGrid.remoteData(params);
|
||||
};
|
||||
new agGrid.Grid(mGridDiv, mGrid);
|
||||
// 读取数据
|
||||
mGrid.remoteData();
|
||||
$ref_promotion = mGrid;
|
||||
|
||||
params['master'] = 0;
|
||||
var sGridDiv = document.querySelector("#ref_promotion_data");
|
||||
var sGrid = new agGridOptions();
|
||||
sGrid.remoteDataUrl = '{{url()}}';
|
||||
sGrid.remoteParams = params;
|
||||
//sGrid.rowMultiSelectWithClick = true;
|
||||
sGrid.rowSelection = 'multiple';
|
||||
sGrid.autoColumnsToFit = false;
|
||||
sGrid.defaultColDef.suppressMenu = true;
|
||||
sGrid.defaultColDef.sortable = false;
|
||||
sGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'product_code', headerName: '存货编码', width: 100},
|
||||
{field: 'product_name', headerName: '商品名称', minWidth: 180},
|
||||
{cellClass:'text-center', field: 'product_spec', headerName: '商品规格', width: 140},
|
||||
{cellClass:'text-center', field: 'unit_name', headerName: '计量单位', width: 80},
|
||||
{cellClass:'text-center', field: 'discount_rate', headerName: '现存量', width: 80},
|
||||
{cellClass:'text-right', field: 'total_quantity', headerName: '促销数量', width: 80},
|
||||
{cellClass:'text-right', field: 'use_quantity', headerName: '已发数量', width: 80},
|
||||
{cellClass:'text-right', field: 'quantity', headerName: '可用数量', width: 80},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
new agGrid.Grid(sGridDiv, sGrid);
|
||||
// 读取数据
|
||||
sGrid.remoteData();
|
||||
$ref_promotion_data = sGrid;
|
||||
|
||||
var data = JSON.parse('{{json_encode($search["forms"])}}');
|
||||
var search = $('#dialog-promotion-search-form').searchForm({
|
||||
data: data,
|
||||
init:function(e) {}
|
||||
});
|
||||
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var query = search.serializeArray();
|
||||
$.map(query, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
|
||||
params['master'] = 1;
|
||||
mGrid.remoteData(params);
|
||||
|
||||
params['master'] = 0;
|
||||
sGrid.remoteData(params);
|
||||
return false;
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,103 @@
|
||||
<div class="form-panel">
|
||||
<div class="form-panel-header">
|
||||
<div class="pull-right">
|
||||
</div>
|
||||
{{$form['btn']}}
|
||||
</div>
|
||||
<div class="form-panel-body panel-form-{{$form['action']}}">
|
||||
<form class="form-horizontal form-controller" method="post" id="{{$form['table']}}" name="{{$form['table']}}">
|
||||
{{$form['tpl']}}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var table = '{{$form["table"]}}';
|
||||
|
||||
gdoo.event.set('stock_record10.invoice_dt', {
|
||||
onpicked() {
|
||||
var date = $('#stock_record10_invoice_dt').val();
|
||||
date = date.replace(/-/gi, '');
|
||||
$.post(app.url('index/api/billSeqNo'), {date: date, bill_id: 59}, function(res) {
|
||||
$('#stock_record10_sn').val(res.data);
|
||||
}, 'json');
|
||||
}
|
||||
});
|
||||
|
||||
var poscode = {};
|
||||
function get_warehouse_poscode() {
|
||||
var warehouse_id = get_warehouse_id();
|
||||
$.post(app.url('stock/location/dialog'), {warehouse_id: warehouse_id}, function (res) {
|
||||
if (res.data.length > 0) {
|
||||
poscode = res.data[0];
|
||||
} else {
|
||||
poscode = {};
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$('#stock_record10_warehouse_id').on('change', function() {
|
||||
get_warehouse_poscode();
|
||||
});
|
||||
get_warehouse_poscode();
|
||||
});
|
||||
|
||||
// grid初始化事件
|
||||
gdoo.event.set('grid.stock_record10_data', {
|
||||
ready(me) {
|
||||
grid = me;
|
||||
grid.dataKey = 'product_id';
|
||||
},
|
||||
editable: {
|
||||
product_name(params) {
|
||||
return has_warehouse_id();
|
||||
},
|
||||
poscode(params) {
|
||||
return has_warehouse_id();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 子表对话框
|
||||
gdoo.event.set('stock_record10_data.product_id', {
|
||||
query(query) {
|
||||
var customer_id = $('#stock_record10_warehouse_id').val();
|
||||
},
|
||||
onSelect(row, selectedRow) {
|
||||
row.poscode = poscode.code;
|
||||
row.posname = poscode.name;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// 选择货位编号
|
||||
gdoo.event.set('stock_record10_data.poscode', {
|
||||
query(query) {
|
||||
var warehouse_id = get_warehouse_id();
|
||||
if (warehouse_id > 0) {
|
||||
query.warehouse_id = warehouse_id;
|
||||
}
|
||||
},
|
||||
onSelect(row, selectedRow) {
|
||||
row.poscode = selectedRow.code;
|
||||
row.posname = selectedRow.name;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
function get_warehouse_id() {
|
||||
var warehouse_id = $('#stock_record10_warehouse_id').val();
|
||||
return warehouse_id || 0;
|
||||
}
|
||||
|
||||
function has_warehouse_id() {
|
||||
var warehouse_id = get_warehouse_id();
|
||||
if (warehouse_id == 0) {
|
||||
toastrError('请先选择仓库');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,59 @@
|
||||
{{$header["js"]}}
|
||||
|
||||
<div class="panel no-border" id="{{$header['master_table']}}-controller">
|
||||
@include('headers')
|
||||
<div class='list-jqgrid'>
|
||||
<div id="{{$header['master_table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
var table = '{{$header["master_table"]}}';
|
||||
var config = gdoo.grids[table];
|
||||
var action = config.action;
|
||||
var search = config.search;
|
||||
|
||||
action.dialogType = 'layer';
|
||||
|
||||
// 自定义搜索方法
|
||||
search.searchInit = function (e) {
|
||||
var self = this;
|
||||
}
|
||||
|
||||
var options = new agGridOptions();
|
||||
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
|
||||
gridDiv.style.height = getPanelHeight(48);
|
||||
|
||||
options.remoteDataUrl = '{{url()}}';
|
||||
options.remoteParams = search.advanced.query;
|
||||
options.columnDefs = config.cols;
|
||||
options.onRowDoubleClicked = function (params) {
|
||||
if (params.node.rowPinned) {
|
||||
return;
|
||||
}
|
||||
if (params.data == undefined) {
|
||||
return;
|
||||
}
|
||||
if (params.data.master_id > 0) {
|
||||
action.show(params.data);
|
||||
}
|
||||
};
|
||||
|
||||
new agGrid.Grid(gridDiv, options);
|
||||
|
||||
// 读取数据
|
||||
options.remoteData({page: 1});
|
||||
|
||||
// 绑定自定义事件
|
||||
var $gridDiv = $(gridDiv);
|
||||
$gridDiv.on('click', '[data-toggle="event"]', function () {
|
||||
var data = $(this).data();
|
||||
if (data.master_id > 0) {
|
||||
action[data.action](data);
|
||||
}
|
||||
});
|
||||
config.grid = options;
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@include('footers')
|
||||
@@ -0,0 +1,26 @@
|
||||
<style>
|
||||
|
||||
.main-container {
|
||||
font:10pt 'STXihei', 'SimSun', sans-serif;
|
||||
}
|
||||
label {
|
||||
font:10pt 'STXihei', 'SimSun', sans-serif;
|
||||
}
|
||||
|
||||
@page {
|
||||
font:10pt 'STXihei', 'SimSun', sans-serif;
|
||||
/*
|
||||
margin: 5mm;
|
||||
size: 210mm 93mm;
|
||||
prince-pdf-page-colorspace: auto;
|
||||
prince-pdf-page-label: auto;
|
||||
prince-rotate-body: 0deg;
|
||||
prince-shrink-to-fit: none;
|
||||
@bottom {
|
||||
content: "第" counter(page)"页,共"counter(pages)"页"
|
||||
}
|
||||
*/
|
||||
}
|
||||
</style>
|
||||
|
||||
{{$form['tpl']}}
|
||||
@@ -0,0 +1,87 @@
|
||||
<div id="div1">
|
||||
<div style="line-height:40px;font-size:14pt;" align=center><strong><font>{{$setting['print_title']}}{{$form['template']['name']}}</font></strong></div>
|
||||
<table border=0 cellspacing=0 cellpadding=0 width="100%" style="font-size:11pt;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="43%"><font>单据编号:<span>{{$master['sn']}}</span></font></td>
|
||||
<td width="33%"><font>入库日期:<span>{{$master['invoice_dt']}}</span></font></td>
|
||||
<td><font>仓库:{{$master['warehouse_name']}}</font></td></tr>
|
||||
<tr>
|
||||
<td><font>入库类别:<span>{{$master['type_name']}}</span></font></td>
|
||||
<td><font>部门:<span>{{$master['department_name']}}</span></font><font></font></td>
|
||||
<td><font>备注:{{$master['remark']}}</font></td></tr>
|
||||
</tbody></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="div2">
|
||||
<style>
|
||||
td { padding: 2px; }
|
||||
</style>
|
||||
<table style="font-size:11pt;" border="1" width="100%" cellspacing="0" cellpadding="0" style="border-collapse:collapse" bordercolor="#000000">
|
||||
<tr>
|
||||
<td align="center">产品编码</td>
|
||||
<td align="center">产品名称</td>
|
||||
<td align="center">规格型号</td>
|
||||
<td align="center">单位</td>
|
||||
<td align="center">数量</td>
|
||||
<td align="center">批号</td>
|
||||
<td align="center">货位</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@foreach($rows as $row)
|
||||
<tr>
|
||||
<td align="center">{{$row['product_code']}}</td>
|
||||
<td align="center">{{$row['product_name']}}</td>
|
||||
<td align="center">{{$row['product_spec']}}</td>
|
||||
<td align="center">{{$row['product_unit']}}</td>
|
||||
<td align="right">@number($row['quantity'], 2)</td>
|
||||
<td align="center">{{$row['batch_sn']}}</td>
|
||||
<td align="center">{{$row['posname']}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
<tfoot>
|
||||
<td align="center">合计</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td tdata="Sum" format="#,##0.00" align="right"><font id="id01">###</font></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="div3">
|
||||
<table width="100%" style="LINE-HEIGHT:30px;font-size:11pt;" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
|
||||
<tr>
|
||||
<td width="40%">制单人:{{auth()->user()->name}}</td>
|
||||
<td width="40%">交货人:</td>
|
||||
<td width="20%" align="right">第<font tdata="PageNO">##</font>页,<font tdata="PageCount">##</font></span>页</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script language="javascript" src="{{$asset_url}}/vendor/LodopFuncs.js"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
var LODOP;
|
||||
function print93() {
|
||||
LODOP = getLodop();
|
||||
|
||||
LODOP.PRINT_INIT("{{$form['template']['name']}}");
|
||||
LODOP.SET_PRINT_PAGESIZE(0, 2100, 930, "CreateCustomPage");
|
||||
var strStyle="<style> table,td,th {border-width:1px;border-style:solid;border-collapse:collapse}</style>"
|
||||
LODOP.ADD_PRINT_TABLE(75, "6%", "88%", 475, strStyle + document.getElementById("div2").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"Vorient", 3);
|
||||
LODOP.ADD_PRINT_HTM(0, "6%", "88%", 109, document.getElementById("div1").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
|
||||
LODOP.ADD_PRINT_HTM(555, "6%","88%", 54, document.getElementById("div3").innerHTML);
|
||||
LODOP.SET_PRINT_STYLEA(0,"ItemType", 1);
|
||||
LODOP.SET_PRINT_STYLEA(0,"LinkedItem", 1);
|
||||
LODOP.PREVIEW();
|
||||
};
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
<div style="width: 100%;text-align:center;">
|
||||
<h2>康虎云报表系统报表打印测试(Ver 1.2.2)</h2>
|
||||
<h3>(PHP版演示)</h3>
|
||||
<div>
|
||||
点按下面的“打印”按钮开始打印<br/>
|
||||
<input type="button" id="btnPrint" value="打印" onClick="doSend(_reportData);" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="readme">
|
||||
说明:<br/>
|
||||
通过修改本页源码中的下列参数控制本页的行为:<br/>
|
||||
<script language="javascript" type="text/javascript"><br/>
|
||||
<span style="color:green">/**下面四个参数必须放在myreport.js脚本后面,以覆盖myreport.js中的默认值**/</span><br/>
|
||||
<span style="color:blue">var</span> _delay_send = <span style="color:red">1000</span>; <span style="color:green">//发送打印服务器前延时时长</span><br/>
|
||||
<span style="color:blue">var</span> _delay_close = <span style="color:red">1000</span>; <span style="color:green">//打印完成后关闭窗口的延时时长, -1则表示不关闭</span><br/>
|
||||
<span style="color:blue">var</span> cfprint_addr = <span style="color:red">"127.0.0.1"</span>; <span style="color:green">//打印服务器监听地址</span><br/>
|
||||
<span style="color:blue">var</span> cfprint_port = <span style="color:red">54321</span>; <span style="color:green">//打印服务器监听端口</span><br/>
|
||||
</script>
|
||||
|
||||
</div>
|
||||
<!-- 定义一个div用以显示实际发送给打印伺服程序的json,方便调试,-->
|
||||
<div id="output"></div>
|
||||
</body>
|
||||
|
||||
<!--下面引入两个必须的 javascript 文件-->
|
||||
<script language="javascript" type="text/javascript" src="{{$asset_url}}/vendor/cfprint/cfprint.min.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="{{$asset_url}}/vendor/cfprint/myreport.js"></script>
|
||||
<!-- 下面重新设置几个参数,以覆盖myreport.js 中的默认值 -->
|
||||
<script language="javascript" type="text/javascript">
|
||||
/**下面四个参数必须放在myreport.js脚本后面,以覆盖myreport.js中的默认值**/
|
||||
var _delay_send = -1; //发送打印服务器前延时时长, -1则表示不自动打印
|
||||
var _delay_close = -1; //打印完成后关闭窗口的延时时长, -1则表示不关闭
|
||||
var cfprint_addr = "127.0.0.1"; //打印服务器监听地址
|
||||
var cfprint_port = 54321; //打印服务器监听端口
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
//把PHP代码里生成的数据json字符串转成javascript放在页面上,
|
||||
//浏览器加载完该页面后会把该数据发送给康虎云报表伺服程序去打印
|
||||
var _reportData = '<?php echo $jsonStr; ?>';
|
||||
|
||||
//在javascript控制台输出一下这个json字符串,对于调试有帮助
|
||||
console.log("reportData = " + _reportData);
|
||||
</script>
|
||||
@@ -0,0 +1,109 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<div class="wrapper-sm" style="padding-bottom:0;">
|
||||
<div id="dialog-promotion-toolbar">
|
||||
<form id="dialog-promotion-search-form" name="dialog_promotion_search_form" class="search-inline-form form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_promotion" class="ag-theme-balham" style="width:100%;height:140px;"></div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_promotion_data" class="ag-theme-balham" style="width:100%;height:240px;"></div>
|
||||
</div>
|
||||
<script>
|
||||
var $ref_promotion = null;
|
||||
var $ref_promotion_data = null;
|
||||
var params = JSON.parse('{{json_encode($query)}}');
|
||||
(function($) {
|
||||
params['master'] = 1;
|
||||
var mGridDiv = document.querySelector("#ref_promotion");
|
||||
var mGrid = new agGridOptions();
|
||||
mGrid.remoteDataUrl = '{{url()}}';
|
||||
mGrid.remoteParams = params;
|
||||
//mGrid.rowMultiSelectWithClick = true;
|
||||
mGrid.rowSelection = 'multiple';
|
||||
mGrid.autoColumnsToFit = false;
|
||||
mGrid.defaultColDef.suppressMenu = true;
|
||||
mGrid.defaultColDef.sortable = false;
|
||||
mGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'sn', headerName: '促销编号', minWidth: 160},
|
||||
{cellClass:'text-center', field: 'created_at', type: 'datetime', headerName: '单据日期', width: 120},
|
||||
{cellClass:'text-center', field: 'status', headerName: '状态', width: 160},
|
||||
{cellClass:'text-center', field: 'customer_code', headerName: '客户编码', width: 160},
|
||||
{field:'customer_name', headerName: '客户名称', width: 160},
|
||||
{field:'warehouse_contact', headerName: '收货人', width: 160},
|
||||
{field:'warehouse_phone', headerName: '收货人电话', width: 160},
|
||||
{field:'warehouse_address', headerName: '收货地址', width: 260},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
mGrid.onSelectionChanged = function() {
|
||||
var rows = mGrid.api.getSelectedRows();
|
||||
var ids = [];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
ids.push(rows[i].id);
|
||||
}
|
||||
params.promotion_ids = ids;
|
||||
sGrid.remoteData(params);
|
||||
};
|
||||
new agGrid.Grid(mGridDiv, mGrid);
|
||||
// 读取数据
|
||||
mGrid.remoteData();
|
||||
$ref_promotion = mGrid;
|
||||
|
||||
params['master'] = 0;
|
||||
var sGridDiv = document.querySelector("#ref_promotion_data");
|
||||
var sGrid = new agGridOptions();
|
||||
sGrid.remoteDataUrl = '{{url()}}';
|
||||
sGrid.remoteParams = params;
|
||||
//sGrid.rowMultiSelectWithClick = true;
|
||||
sGrid.rowSelection = 'multiple';
|
||||
sGrid.autoColumnsToFit = false;
|
||||
sGrid.defaultColDef.suppressMenu = true;
|
||||
sGrid.defaultColDef.sortable = false;
|
||||
sGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'product_code', headerName: '存货编码', width: 100},
|
||||
{field: 'product_name', headerName: '商品名称', minWidth: 180},
|
||||
{cellClass:'text-center', field: 'product_spec', headerName: '商品规格', width: 140},
|
||||
{cellClass:'text-center', field: 'unit_name', headerName: '计量单位', width: 80},
|
||||
{cellClass:'text-center', field: 'discount_rate', headerName: '现存量', width: 80},
|
||||
{cellClass:'text-right', field: 'total_quantity', headerName: '促销数量', width: 80},
|
||||
{cellClass:'text-right', field: 'use_quantity', headerName: '已发数量', width: 80},
|
||||
{cellClass:'text-right', field: 'quantity', headerName: '可用数量', width: 80},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
new agGrid.Grid(sGridDiv, sGrid);
|
||||
// 读取数据
|
||||
sGrid.remoteData();
|
||||
$ref_promotion_data = sGrid;
|
||||
|
||||
var data = JSON.parse('{{json_encode($search["forms"])}}');
|
||||
var search = $('#dialog-promotion-search-form').searchForm({
|
||||
data: data,
|
||||
init:function(e) {}
|
||||
});
|
||||
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var query = search.serializeArray();
|
||||
$.map(query, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
|
||||
params['master'] = 1;
|
||||
mGrid.remoteData(params);
|
||||
|
||||
params['master'] = 0;
|
||||
sGrid.remoteData(params);
|
||||
return false;
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,128 @@
|
||||
<div class="form-panel">
|
||||
<div class="form-panel-header">
|
||||
<div class="pull-right">
|
||||
</div>
|
||||
{{$form['btn']}}
|
||||
|
||||
</div>
|
||||
<div class="form-panel-body panel-form-{{$form['action']}}">
|
||||
<form class="form-horizontal form-controller" method="post" id="{{$form['table']}}" name="{{$form['table']}}">
|
||||
{{$form['tpl']}}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var table = '{{$form["table"]}}';
|
||||
|
||||
// grid初始化事件
|
||||
gdoo.event.set('grid.stock_record11_data', {
|
||||
ready(me) {
|
||||
grid = me;
|
||||
grid.dataKey = 'product_id';
|
||||
},
|
||||
editable: {
|
||||
product_name(params) {
|
||||
return has_warehouse_id();
|
||||
},
|
||||
batch_sn(params) {
|
||||
var row = params.data;
|
||||
if (row.product_id > 0) {
|
||||
} else {
|
||||
toastrError('请先选择产品');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
poscode(params) {
|
||||
var row = params.data;
|
||||
if (row.product_id > 0) {
|
||||
} else {
|
||||
toastrError('请先选择产品');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 子表对话框
|
||||
gdoo.event.set('stock_record11_data.product_id', {
|
||||
query(query) {
|
||||
},
|
||||
onSelect(row, selectedRow) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
function get_warehouse_id() {
|
||||
var customer_id = $('#stock_record11_warehouse_id').val();
|
||||
return customer_id || 0;
|
||||
}
|
||||
|
||||
function has_warehouse_id() {
|
||||
var warehouse_id = get_warehouse_id();
|
||||
if (warehouse_id == 0) {
|
||||
toastrError('请先选择仓库');
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 选择库存
|
||||
function stockSelect() {
|
||||
if (has_warehouse_id() == false) {
|
||||
return;
|
||||
}
|
||||
var buttons = [{
|
||||
text: "取消",
|
||||
'class': "btn-default",
|
||||
click: function () {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}];
|
||||
buttons.push({
|
||||
text: '提交',
|
||||
'class': 'btn-info',
|
||||
click: function () {
|
||||
var rows = $ref_stock_select.api.getSelectedRows();
|
||||
stockRowsSelected(rows);
|
||||
$(this).dialog('close');
|
||||
}
|
||||
});
|
||||
var warehouse_id = get_warehouse_id();
|
||||
$.dialog({
|
||||
title: '选择库存',
|
||||
url: '{{url("stock/allocation/stockSelect")}}?warehouse_id=' + warehouse_id,
|
||||
dialogClass: 'modal-lg',
|
||||
buttons: buttons
|
||||
});
|
||||
}
|
||||
window.stockSelect = stockSelect;
|
||||
|
||||
// 库存写入
|
||||
var stockRowsSelected = function(rows) {
|
||||
if (rows.length == 0) {
|
||||
return;
|
||||
}
|
||||
grid.api.forEachNode(function (node) {
|
||||
var data = node.data;
|
||||
if (isEmpty(data.product_id)) {
|
||||
grid.api.updateRowData({remove:[data]});
|
||||
}
|
||||
});
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
row.quantity = parseFloat(row.ky_num);
|
||||
row.total_weight = row.quantity * row.weight;
|
||||
row.money = row.quantity * row.price;
|
||||
grid.api.memoryStore.create(row);
|
||||
}
|
||||
grid.generatePinnedBottomData();
|
||||
return true;
|
||||
};
|
||||
window.stockRowsSelected = stockRowsSelected;
|
||||
</script>
|
||||
@@ -0,0 +1,59 @@
|
||||
{{$header["js"]}}
|
||||
|
||||
<div class="panel no-border" id="{{$header['master_table']}}-controller">
|
||||
@include('headers')
|
||||
<div class='list-jqgrid'>
|
||||
<div id="{{$header['master_table']}}-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function ($) {
|
||||
var table = '{{$header["master_table"]}}';
|
||||
var config = gdoo.grids[table];
|
||||
var action = config.action;
|
||||
var search = config.search;
|
||||
|
||||
action.dialogType = 'layer';
|
||||
|
||||
// 自定义搜索方法
|
||||
search.searchInit = function (e) {
|
||||
var self = this;
|
||||
}
|
||||
|
||||
var options = new agGridOptions();
|
||||
var gridDiv = document.querySelector("#{{$header['master_table']}}-grid");
|
||||
gridDiv.style.height = getPanelHeight(48);
|
||||
|
||||
options.remoteDataUrl = '{{url()}}';
|
||||
options.remoteParams = search.advanced.query;
|
||||
options.columnDefs = config.cols;
|
||||
options.onRowDoubleClicked = function (params) {
|
||||
if (params.node.rowPinned) {
|
||||
return;
|
||||
}
|
||||
if (params.data == undefined) {
|
||||
return;
|
||||
}
|
||||
if (params.data.master_id > 0) {
|
||||
action.show(params.data);
|
||||
}
|
||||
};
|
||||
|
||||
new agGrid.Grid(gridDiv, options);
|
||||
|
||||
// 读取数据
|
||||
options.remoteData({page: 1});
|
||||
|
||||
// 绑定自定义事件
|
||||
var $gridDiv = $(gridDiv);
|
||||
$gridDiv.on('click', '[data-toggle="event"]', function () {
|
||||
var data = $(this).data();
|
||||
if (data.master_id > 0) {
|
||||
action[data.action](data);
|
||||
}
|
||||
});
|
||||
config.grid = options;
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@include('footers')
|
||||
@@ -0,0 +1 @@
|
||||
{{$form['tpl']}}
|
||||
@@ -0,0 +1,109 @@
|
||||
<style>
|
||||
.modal-body { overflow:hidden; }
|
||||
</style>
|
||||
|
||||
<div class="wrapper-sm" style="padding-bottom:0;">
|
||||
<div id="dialog-promotion-toolbar">
|
||||
<form id="dialog-promotion-search-form" name="dialog_promotion_search_form" class="search-inline-form form-inline" method="get">
|
||||
@include('searchForm3')
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_promotion" class="ag-theme-balham" style="width:100%;height:140px;"></div>
|
||||
</div>
|
||||
|
||||
<div class="m-t-sm">
|
||||
<div id="ref_promotion_data" class="ag-theme-balham" style="width:100%;height:240px;"></div>
|
||||
</div>
|
||||
<script>
|
||||
var $ref_promotion = null;
|
||||
var $ref_promotion_data = null;
|
||||
var params = JSON.parse('{{json_encode($query)}}');
|
||||
(function($) {
|
||||
params['master'] = 1;
|
||||
var mGridDiv = document.querySelector("#ref_promotion");
|
||||
var mGrid = new agGridOptions();
|
||||
mGrid.remoteDataUrl = '{{url()}}';
|
||||
mGrid.remoteParams = params;
|
||||
//mGrid.rowMultiSelectWithClick = true;
|
||||
mGrid.rowSelection = 'multiple';
|
||||
mGrid.autoColumnsToFit = false;
|
||||
mGrid.defaultColDef.suppressMenu = true;
|
||||
mGrid.defaultColDef.sortable = false;
|
||||
mGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'sn', headerName: '促销编号', minWidth: 160},
|
||||
{cellClass:'text-center', field: 'created_at', type: 'datetime', headerName: '单据日期', width: 120},
|
||||
{cellClass:'text-center', field: 'status', headerName: '状态', width: 160},
|
||||
{cellClass:'text-center', field: 'customer_code', headerName: '客户编码', width: 160},
|
||||
{field:'customer_name', headerName: '客户名称', width: 160},
|
||||
{field:'warehouse_contact', headerName: '收货人', width: 160},
|
||||
{field:'warehouse_phone', headerName: '收货人电话', width: 160},
|
||||
{field:'warehouse_address', headerName: '收货地址', width: 260},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
|
||||
mGrid.onSelectionChanged = function() {
|
||||
var rows = mGrid.api.getSelectedRows();
|
||||
var ids = [];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
ids.push(rows[i].id);
|
||||
}
|
||||
params.promotion_ids = ids;
|
||||
sGrid.remoteData(params);
|
||||
};
|
||||
new agGrid.Grid(mGridDiv, mGrid);
|
||||
// 读取数据
|
||||
mGrid.remoteData();
|
||||
$ref_promotion = mGrid;
|
||||
|
||||
params['master'] = 0;
|
||||
var sGridDiv = document.querySelector("#ref_promotion_data");
|
||||
var sGrid = new agGridOptions();
|
||||
sGrid.remoteDataUrl = '{{url()}}';
|
||||
sGrid.remoteParams = params;
|
||||
//sGrid.rowMultiSelectWithClick = true;
|
||||
sGrid.rowSelection = 'multiple';
|
||||
sGrid.autoColumnsToFit = false;
|
||||
sGrid.defaultColDef.suppressMenu = true;
|
||||
sGrid.defaultColDef.sortable = false;
|
||||
sGrid.columnDefs = [
|
||||
{cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: true, suppressSizeToFit: true, width: 40},
|
||||
{cellClass:'text-center', field: 'product_code', headerName: '存货编码', width: 100},
|
||||
{field: 'product_name', headerName: '商品名称', minWidth: 180},
|
||||
{cellClass:'text-center', field: 'product_spec', headerName: '商品规格', width: 140},
|
||||
{cellClass:'text-center', field: 'unit_name', headerName: '计量单位', width: 80},
|
||||
{cellClass:'text-center', field: 'discount_rate', headerName: '现存量', width: 80},
|
||||
{cellClass:'text-right', field: 'total_quantity', headerName: '促销数量', width: 80},
|
||||
{cellClass:'text-right', field: 'use_quantity', headerName: '已发数量', width: 80},
|
||||
{cellClass:'text-right', field: 'quantity', headerName: '可用数量', width: 80},
|
||||
{cellClass:'text-center', field: 'id', headerName: 'ID', width: 60}
|
||||
];
|
||||
new agGrid.Grid(sGridDiv, sGrid);
|
||||
// 读取数据
|
||||
sGrid.remoteData();
|
||||
$ref_promotion_data = sGrid;
|
||||
|
||||
var data = JSON.parse('{{json_encode($search["forms"])}}');
|
||||
var search = $('#dialog-promotion-search-form').searchForm({
|
||||
data: data,
|
||||
init:function(e) {}
|
||||
});
|
||||
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var query = search.serializeArray();
|
||||
$.map(query, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
|
||||
params['master'] = 1;
|
||||
mGrid.remoteData(params);
|
||||
|
||||
params['master'] = 0;
|
||||
sGrid.remoteData(params);
|
||||
return false;
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
@@ -0,0 +1,137 @@
|
||||
<div class="panel no-border" id="material_plan-controller">
|
||||
|
||||
<div class="wrapper-sm">
|
||||
@include('searchForm7')
|
||||
<a class="btn btn-sm btn-default" data-toggle="material_plan" data-action="filter"><i class="fa fa-search"></i> 筛选</a>
|
||||
<a class="btn btn-sm btn-default" data-toggle="material_plan" data-action="export"><i class="fa fa-share"></i> 导出</a>
|
||||
</div>
|
||||
|
||||
<div class='list-jqgrid'>
|
||||
<div id="material_plan-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.ag-row {
|
||||
display:table;
|
||||
}
|
||||
.rowspan {
|
||||
background-color: #fff;
|
||||
top: -1px;
|
||||
border-top: 1px solid #d9dcde !important;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.rowspan_end {
|
||||
border-bottom: 1px solid #d9dcde !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
(function ($) {
|
||||
var searchOpen = false;
|
||||
var table = 'material_plan';
|
||||
var search = JSON.parse('{{json_encode($search)}}');
|
||||
var cols = [
|
||||
{field: "sn", cellClass: "text-center", suppressSizeToFit: true, headerName: "", type: 'sn', width: 60},
|
||||
{field: "invoice_dt", cellClass: "text-center", headerName: "日期", sortable: true, suppressMenu: true, width: 80},
|
||||
{field: "sn", cellClass: "text-center", headerName: "单据编号", sortable: true, suppressMenu: true, width: 120},
|
||||
{field: "bill_name", cellClass: "text-center", headerName: "单据类型", sortable: false, suppressMenu: true, width: 90},
|
||||
{field: "warehouse_name", headerName: "仓库名称", sortable: false, suppressMenu: true, width: 90},
|
||||
{field: "product_code", headerName: "产品编码", sortable: true, suppressMenu: true, cellClass: "text-center", width: 100},
|
||||
{field: "product_name", headerName: "产品名称", sortable: false, suppressMenu: true, cellClass: "text-center", width: 140},
|
||||
{field: "product_spec", headerName: "规格型号", sortable: false, suppressMenu: true, cellClass: "text-center", width: 80},
|
||||
{field: "unit_name", headerName: "计量单位", sortable: false, suppressMenu: true, cellClass: "text-center", width: 60},
|
||||
{field: "batch_sn", headerName: "产品批号", sortable: true, suppressMenu: true, cellClass: "text-center", width: 90},
|
||||
{field: "batch_date", headerName: "产品日期", sortable: true, suppressMenu: true, cellClass: "text-center", width: 90},
|
||||
{field: "poscode", headerName: "货位编号", sortable: true, suppressMenu: true, cellClass: "text-center", width: 80},
|
||||
{field: "posname", headerName: "货位名称", sortable: false, suppressMenu: true, cellClass: "text-center", width: 80},
|
||||
{field: "rk_num", headerName: "入库数量", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 90},
|
||||
{field: "ck_num", headerName: "出库数量", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 90},
|
||||
{field: "qm_num", headerName: "结存数量", sortable: true, suppressMenu: true, type:'number', cellClass: "text-right", width: 90},
|
||||
];
|
||||
|
||||
var grid = new agGridOptions();
|
||||
grid.suppressRowTransform = true;
|
||||
var gridDiv = document.querySelector("#material_plan-grid");
|
||||
gridDiv.style.height = getPanelHeight(12);
|
||||
|
||||
grid.remoteDataUrl = '{{url()}}';
|
||||
grid.remoteParams = search.query;
|
||||
grid.columnDefs = cols;
|
||||
grid.rowSelection = 'single';
|
||||
new agGrid.Grid(gridDiv, grid);
|
||||
|
||||
// 读取数据
|
||||
grid.remoteData({page: 1});
|
||||
|
||||
// 绑定自定义事件
|
||||
var $gridDiv = $(gridDiv);
|
||||
$gridDiv.on('click', '[data-toggle="event"]', function () {
|
||||
var data = $(this).data();
|
||||
if (data.master_id > 0) {
|
||||
action[data.action](data);
|
||||
}
|
||||
});
|
||||
|
||||
var data = search.forms;
|
||||
var search = $("#material_plan-search-form-advanced");
|
||||
search.searchForm({
|
||||
data: data,
|
||||
advanced: 1,
|
||||
});
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var params = search.serializeArray();
|
||||
$.map(params, function(row) {
|
||||
data[row.name] = row.value;
|
||||
});
|
||||
grid.remoteData(data);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#material_plan-controller').on('click', '[data-toggle="material_plan"]', function() {
|
||||
var data = $(this).data();
|
||||
if (data.action == 'filter') {
|
||||
searchBox();
|
||||
}
|
||||
if (data.action == 'export') {
|
||||
LocalExport(grid, '库存明细表');
|
||||
}
|
||||
});
|
||||
|
||||
var searchBox = function() {
|
||||
$(search).dialog({
|
||||
title: '筛选条件',
|
||||
modalClass: 'no-padder',
|
||||
buttons: [{
|
||||
text: "取消",
|
||||
'class': "btn-default",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
},{
|
||||
text: "确定",
|
||||
'class': "btn-info",
|
||||
click: function() {
|
||||
var data = search.serializeArray();
|
||||
var params = {};
|
||||
search.queryType = 'advanced';
|
||||
$.map(data, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
params['filter'] = 1;
|
||||
grid.remoteData(params);
|
||||
$(this).dialog("close");
|
||||
return false;
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
if (searchOpen == false) {
|
||||
searchBox();
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,147 @@
|
||||
<div class="panel no-border" id="material_plan-controller">
|
||||
|
||||
<div class="wrapper-sm">
|
||||
@include('searchForm7')
|
||||
<a class="btn btn-sm btn-default" data-toggle="material_plan" data-action="filter"><i class="fa fa-search"></i> 筛选</a>
|
||||
<a class="btn btn-sm btn-default" data-toggle="material_plan" data-action="export"><i class="fa fa-share"></i> 导出</a>
|
||||
</div>
|
||||
|
||||
<div class='list-jqgrid'>
|
||||
<div id="material_plan-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.ag-row {
|
||||
display:table;
|
||||
}
|
||||
.rowspan {
|
||||
background-color: #fff;
|
||||
top: -1px;
|
||||
border-top: 1px solid #d9dcde !important;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.rowspan_end {
|
||||
border-bottom: 1px solid #d9dcde !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
(function ($) {
|
||||
var searchOpen = false;
|
||||
var table = 'material_plan';
|
||||
var search = JSON.parse('{{json_encode($search)}}');
|
||||
var cols = [
|
||||
{field: "sn", cellClass: "text-center", suppressSizeToFit: true, headerName: "", type: 'sn', width: 60},
|
||||
{field: "warehouse_name", headerName: "仓库名称", sortable: false, suppressMenu: true, width: 100},
|
||||
{field: "product_code", headerName: "产品编码", sortable: true, suppressMenu: true, cellClass: "text-center", width: 100},
|
||||
{field: "product_name", headerName: "产品名称", sortable: false, suppressMenu: true, cellClass: "text-center", width: 120},
|
||||
{field: "product_spec", headerName: "规格型号", sortable: false, suppressMenu: true, cellClass: "text-center", width: 100},
|
||||
{field: "product_unit", headerName: "计量单位", sortable: false, suppressMenu: true, cellClass: "text-center", width: 100},
|
||||
{field: "batch_sn", headerName: "产品批号", sortable: true, suppressMenu: true, cellClass: "text-center", width: 90},
|
||||
{field: "batch_date", headerName: "产品日期", sortable: true, suppressMenu: true, cellClass: "text-center", width: 90},
|
||||
{field: "poscode", headerName: "货位编号", sortable: true, suppressMenu: true, cellClass: "text-center", width: 90},
|
||||
{field: "posname", headerName: "货位名称", sortable: false, suppressMenu: true, cellClass: "text-center", width: 90},
|
||||
|
||||
{field: "qc_num", headerName: "期初数量", sortable: true, suppressMenu: true, type:'number', cellClass: "text-right", calcFooter:'sum', width: 90},
|
||||
{field: "rk_num_sc", headerName: "生产入库", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 90},
|
||||
{field: "rk_num_qr", headerName: "调拨入库", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 90},
|
||||
{field: "rk_num_th", headerName: "退货入库", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 90},
|
||||
{field: "rk_num_qt", headerName: "其他入库", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 90},
|
||||
{field: "rk_num", headerName: "入库合计数量", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 90},
|
||||
{field: "ck_num_fh", headerName: "发货出库", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 90},
|
||||
{field: "ck_num_zy", headerName: "直营发货出库", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 90},
|
||||
{field: "ck_num_dc", headerName: "调拨出库", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 90},
|
||||
{field: "ck_num_qt", headerName: "其他出库", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 90},
|
||||
{field: "ck_num", headerName: "出库合计数量", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 90},
|
||||
{field: "qm_num", headerName: "结存数量", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 90},
|
||||
{field: "rk_num_no", headerName: "其中待入数量", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 90},
|
||||
{field: "ck_num_no", headerName: "其中待出数量", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 90},
|
||||
];
|
||||
|
||||
var grid = new agGridOptions();
|
||||
grid.suppressRowTransform = true;
|
||||
var gridDiv = document.querySelector("#material_plan-grid");
|
||||
gridDiv.style.height = getPanelHeight(12);
|
||||
|
||||
grid.remoteDataUrl = '{{url()}}';
|
||||
grid.remoteParams = search.query;
|
||||
grid.columnDefs = cols;
|
||||
grid.rowSelection = 'single';
|
||||
grid.autoColumnsToFit = false;
|
||||
new agGrid.Grid(gridDiv, grid);
|
||||
|
||||
// 读取数据
|
||||
grid.remoteData({page: 1});
|
||||
|
||||
// 绑定自定义事件
|
||||
var $gridDiv = $(gridDiv);
|
||||
$gridDiv.on('click', '[data-toggle="event"]', function () {
|
||||
var data = $(this).data();
|
||||
if (data.master_id > 0) {
|
||||
action[data.action](data);
|
||||
}
|
||||
});
|
||||
|
||||
var data = search.forms;
|
||||
var search = $("#material_plan-search-form-advanced");
|
||||
search.searchForm({
|
||||
data: data,
|
||||
advanced: 1,
|
||||
});
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var params = search.serializeArray();
|
||||
$.map(params, function(row) {
|
||||
data[row.name] = row.value;
|
||||
});
|
||||
grid.remoteData(data);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#material_plan-controller').on('click', '[data-toggle="material_plan"]', function() {
|
||||
var data = $(this).data();
|
||||
if (data.action == 'filter') {
|
||||
searchBox();
|
||||
}
|
||||
if (data.action == 'export') {
|
||||
LocalExport(grid, '库存明细表');
|
||||
}
|
||||
});
|
||||
|
||||
var searchBox = function() {
|
||||
$(search).dialog({
|
||||
title: '筛选条件',
|
||||
modalClass: 'no-padder',
|
||||
buttons: [{
|
||||
text: "取消",
|
||||
'class': "btn-default",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
},{
|
||||
text: "确定",
|
||||
'class': "btn-info",
|
||||
click: function() {
|
||||
var data = search.serializeArray();
|
||||
var params = {};
|
||||
search.queryType = 'advanced';
|
||||
$.map(data, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
params['filter'] = 1;
|
||||
grid.remoteData(params);
|
||||
$(this).dialog("close");
|
||||
return false;
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
if (searchOpen == false) {
|
||||
searchBox();
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,144 @@
|
||||
<div class="panel no-border" id="material_plan-controller">
|
||||
|
||||
<div class="wrapper-sm">
|
||||
@include('searchForm7')
|
||||
<a class="btn btn-sm btn-default" data-toggle="material_plan" data-action="filter"><i class="fa fa-search"></i> 筛选</a>
|
||||
<a class="btn btn-sm btn-default" data-toggle="material_plan" data-action="export"><i class="fa fa-share"></i> 导出</a>
|
||||
</div>
|
||||
|
||||
<div class='list-jqgrid'>
|
||||
<div id="material_plan-grid" style="width:100%;" class="ag-theme-balham"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.ag-row {
|
||||
display:table;
|
||||
}
|
||||
.rowspan {
|
||||
background-color: #fff;
|
||||
top: -1px;
|
||||
border-top: 1px solid #d9dcde !important;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.rowspan_end {
|
||||
border-bottom: 1px solid #d9dcde !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
(function ($) {
|
||||
var searchOpen = false;
|
||||
var table = 'material_plan';
|
||||
var search = JSON.parse('{{json_encode($search)}}');
|
||||
var cols = [
|
||||
{field: "sn", cellClass: "text-center", suppressSizeToFit: true, headerName: "", type: 'sn', width: 60},
|
||||
{field: "warehouse_name", headerName: "仓库名称", sortable: false, suppressMenu: true, width: 80},
|
||||
{field: "product_code", headerName: "产品编码", sortable: true, suppressMenu: true, cellClass: "text-center", width: 80},
|
||||
{field: "product_name", headerName: "产品名称", sortable: false, suppressMenu: true, cellClass: "text-center", width: 120},
|
||||
{field: "product_spec", headerName: "规格型号", sortable: false, suppressMenu: true, cellClass: "text-center", width: 60},
|
||||
{field: "unit_name", headerName: "计量单位", sortable: false, suppressMenu: true, cellClass: "text-center", width: 60},
|
||||
{field: "batch_sn", headerName: "产品批号", sortable: true, suppressMenu: true, cellClass: "text-center", width: 80},
|
||||
{field: "batch_date", headerName: "产品日期", sortable: true, suppressMenu: true, cellClass: "text-center", width: 80},
|
||||
{field: "poscode", headerName: "货位编号", sortable: true, suppressMenu: true, cellClass: "text-center", width: 80},
|
||||
{field: "posname", headerName: "货位名称", sortable: false, suppressMenu: true, cellClass: "text-center", width: 80},
|
||||
{field: "num", headerName: "库存数量", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 80},
|
||||
{field: "rknum", headerName: "待入库数量", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 80},
|
||||
{field: "cknum", headerName: "待出库数量", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 80},
|
||||
{field: "fhnum", headerName: "待发货数量", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 80},
|
||||
{field: "kynum", headerName: "可用数量", sortable: true, suppressMenu: true, type:'number', calcFooter:'sum', cellClass: "text-right", width: 80},
|
||||
];
|
||||
|
||||
var grid = new agGridOptions();
|
||||
grid.suppressRowTransform = true;
|
||||
var gridDiv = document.querySelector("#material_plan-grid");
|
||||
gridDiv.style.height = getPanelHeight(12);
|
||||
|
||||
grid.getRowClass = function(params) {
|
||||
var data = params.data;
|
||||
params.node.setSelected(true);
|
||||
if (toNumber(data.kyNum) < 0) {
|
||||
return 'ag-row-warn';
|
||||
}
|
||||
};
|
||||
|
||||
grid.remoteDataUrl = '{{url()}}';
|
||||
grid.remoteParams = search.query;
|
||||
grid.columnDefs = cols;
|
||||
grid.rowSelection = 'single';
|
||||
new agGrid.Grid(gridDiv, grid);
|
||||
|
||||
// 读取数据
|
||||
grid.remoteData({page: 1});
|
||||
|
||||
// 绑定自定义事件
|
||||
var $gridDiv = $(gridDiv);
|
||||
$gridDiv.on('click', '[data-toggle="event"]', function () {
|
||||
var data = $(this).data();
|
||||
if (data.master_id > 0) {
|
||||
action[data.action](data);
|
||||
}
|
||||
});
|
||||
|
||||
var data = search.forms;
|
||||
var search = $("#material_plan-search-form-advanced");
|
||||
search.searchForm({
|
||||
data: data,
|
||||
advanced: 1,
|
||||
});
|
||||
search.find('#search-submit').on('click', function() {
|
||||
var params = search.serializeArray();
|
||||
$.map(params, function(row) {
|
||||
data[row.name] = row.value;
|
||||
});
|
||||
grid.remoteData(data);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#material_plan-controller').on('click', '[data-toggle="material_plan"]', function() {
|
||||
var data = $(this).data();
|
||||
if (data.action == 'filter') {
|
||||
searchBox();
|
||||
}
|
||||
if (data.action == 'export') {
|
||||
LocalExport(grid, '库存明细表');
|
||||
}
|
||||
});
|
||||
|
||||
var searchBox = function() {
|
||||
$(search).dialog({
|
||||
title: '筛选条件',
|
||||
modalClass: 'no-padder',
|
||||
buttons: [{
|
||||
text: "取消",
|
||||
'class': "btn-default",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
},{
|
||||
text: "确定",
|
||||
'class': "btn-info",
|
||||
click: function() {
|
||||
var data = search.serializeArray();
|
||||
var params = {};
|
||||
search.queryType = 'advanced';
|
||||
$.map(data, function(row) {
|
||||
params[row.name] = row.value;
|
||||
});
|
||||
params['filter'] = 1;
|
||||
grid.remoteData(params);
|
||||
$(this).dialog("close");
|
||||
return false;
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
if (searchOpen == false) {
|
||||
searchBox();
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user