创建版本
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user