创建版本

This commit is contained in:
2021-02-22 12:17:00 +08:00
commit af555f49c3
2332 changed files with 369202 additions and 0 deletions
@@ -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>