You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/Viewsjs/RptWmsSettle/RptWmsSettleEdit.js

1567 lines
64 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
String.prototype.trim = function () { return this.replace(/(^\s*)|(\s*$)/g, ""); }
Shipping.RptWmsSettleEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.RptWmsSettleEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.RptWmsSettleEdit, Ext.Panel, {
PageSize: 1000, //每页的条数
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
//#region 编辑form
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.FeeSql = '';
this.BillSql = '';
this.DuiBillSql = '';
//#region 账单信息加载
//对账客户
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: ""} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '对账客户',
store: this.storeCustCode,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CustName'//CodeAndName
});
//打印模板
this.storeDuiTemplate = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeDuiTemplate',
proxy: { url: '/MvcShipping/MsCodeDuiTemplate/GetDataList' }
});
this.storeDuiTemplate.load({ params: { condition: ""} });
this.comboxDuiTemplate = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '打印模板',
store: this.storeDuiTemplate,
forceSelection: true,
name: 'DM_ID',
valueField: 'DM_ID',
displayField: 'NAME'
});
//#endregion
//#region 账单信息布局
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
//bodyPadding: 5,
autoScroll: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '对账编号',
readOnly: true, //, hidden: true
name: 'DUINO'
}, this.comboxCustCode, {
id: "STARTBILLINGDATE",
fieldLabel: '开始对账日期',
readOnly: true,
name: 'STARTBILLINGDATE'
}, {
id: "ENDBILLINGDATE",
fieldLabel: '结束对账日期',
readOnly: true,
name: 'ENDBILLINGDATE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注',
name: 'REMARK',
flex: 4
}]
}]//end items(fieldset 1)
}]//end root items
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
id: "btsave",
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, '-', {
id: "btsave2",
text: "保存", //保存并关闭
handler: function (button, event) {
this.Save('1');
},
scope: this
}, {
id: "btdel",
text: "删除",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, {
text: "打印",
handler: function (button, event) {
this.Print();
},
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 账单明细
//明细表表格相关
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//明细表-数据集
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'RptWmsSettleListEntity',
remoteSort: true,
proxy: {
type: 'ajax',
timeout: 6000000, //60秒,
url: '/MvcShipping/RptWmsSettle/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region List列表自增序号列生成
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
//#region 查询的主列表_提单号_加载
this.storeMblnoList = Ext.create('Ext.data.Store', {
model: 'wms_settle_detail_mblno',
remoteSort: true,
proxy: {
type: 'ajax',
timeout: 6000000, //60秒,
url: '/MvcShipping/RptWmsSettle/GetBLListData',
reader: {
id: 'GID', //,DUINO
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeMblnoModel = Ext.create('Ext.selection.CheckboxModel');
this.gridMblnoList = new Ext.grid.GridPanel({
store: this.storeMblnoList,
selModel: this.storeMblnoModel,
enableHdMenu: false,
//region: 'center',
//region: 'west',
region: 'north',
height: 150,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false, //是否禁止行选择默认为false
stripeRows: true, //表格是否隔行换色默认为false
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
features: [{
ftype: 'summary'
}],
columns: [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'BLNO',
header: '提单号',
width: 150
}, {
sortable: true,
dataIndex: 'CUSTOMNO',
header: '备案清单号',
width: 150
}, {
sortable: true,
dataIndex: 'CONTRACTNO',
header: '合同号',
width: 150
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '对账客户',
width: 150
}, {
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 100
}, {
sortable: true,
dataIndex: 'OUTFEE',
header: '仓储费',
width: 100,
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
return '<div name="OUTFEE' + record.data.DUIGID + '" class="TipDiv">' + usMoney(value, 2, '', true) + '</div>';
}
}, {
sortable: true,
dataIndex: 'DUIGID',
header: '对账GID',
width: 0
}, {
sortable: true,
dataIndex: 'DUINO',
header: '对账编号',
width: 0
}]
});
this.gridMblnoList.columns[0] = new Ext.grid.RowNumberer();
//#endregion
//#region 查询的主列表加载
this.storeBodyAddList = Ext.create('Ext.data.Store', {
model: 'wms_settle_detail',
remoteSort: true,
proxy: {
type: 'ajax',
timeout: 6000000, //60秒,
url: '/MvcShipping/RptWmsSettle/GetMblnoDetailList',
reader: {
id: 'GID', //,DUINO
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.AddGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridAddList = new Ext.grid.GridPanel({
store: this.storeBodyAddList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.AddGridCheckBoxModel,
viewConfig: {
enableTextSelection: true, //允许复制数据
autoFill: true
},
tbar: [{
id: "btdetaildel",
text: "删除明细",
handler: function (button, event) {
this.onDeleteDetailClick(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'STORAGENAME',
header: '仓库名称',
width: 100
}, {
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 100
}, {
sortable: true,
dataIndex: 'GOODSMODEL',
header: '型号',
width: 100
}, {
sortable: true,
dataIndex: 'GOODSSTANDARD',
header: '规格',
width: 100
}, {
sortable: true,
dataIndex: 'WMSNO',
header: '入库单号',
width: 100
}, {
sortable: true,
dataIndex: 'OUTBSNO',
header: '出库单号',
width: 100
},
// {
// sortable: true,
// dataIndex: 'BSNO_OUT',
// header: '出库明细单号',
// width: 100
// },
{
sortable: true,
dataIndex: 'WMSDATE',
header: '入库日期',
//renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'DODATE',
header: '出库日期',
//renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'STARTBILLINGDATE',
header: '开始计费日期',
//renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'ENDBILLINGDATE',
header: '结束计费日期',
//renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'GOODSRKSL',
header: '入库数量',
width: 100
}, {
sortable: true,
dataIndex: 'GOODSPFSL',
header: '出库数量',
width: 100
}, {
sortable: true,
dataIndex: 'GOODSSTOCK',
header: '库存数量',
width: 100
}, {
sortable: true,
dataIndex: 'FEEDAYS',
header: '计费天数',
width: 100
}, {
sortable: true,
dataIndex: 'OUTFEE',
header: '仓储费',
width: 100
}, {
sortable: true,
dataIndex: 'GID_LINK',
header: '出库主表GID',
width: 0
}]
});
//#endregion
//#region 查询条件信息加载
//委托单位
this.storeCustomer = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
});
//this.storeCustomer.load({ params: { condition: ""} });
this.comboxCustomer = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '<font color=red style="font-weight: bold;">对账客户</font>',
store: this.storeCustomer,
forceSelection: true,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
lazyRender: false,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
change: function (field, newValue, oldValue) {
//this.comboxCustCode.setValue(newValue);
Ext.getCmp('CUSTOMERNAME').setValue(newValue);
},
scope: this
}
});
//
this.storeStock = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
//proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeStock.load({ params: { condition: " ISWAREHOUSE=1 "} });
this.comboxStock = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '仓库名称',
store: this.storeStock,
forceSelection: true,
name: 'STORAGENAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//
Ext.define('CHARGEUNIT', {
extend: 'Ext.data.Model',
fields: [
{ name: 'Name', type: 'string' }
]
});
var CHARGEUNITData = [{ "Name": "吨" }, { "Name": "千克" }, { "Name": "立方" }, { "Name": "CBM" }, { "Name": ""}];
var storeCHARGEUNIT = Ext.create('Ext.data.Store', {
model: 'CHARGEUNIT',
data: CHARGEUNITData
});
this.comboxCHARGEUNIT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '计费单位',
forceSelection: true,
store: storeCHARGEUNIT,
name: 'CHARGEUNIT',
valueField: 'Name',
displayField: 'Name'
});
//
Ext.define('STOCKTYPE', {
extend: 'Ext.data.Model',
fields: [
{ name: 'Name', type: 'string' }
]
});
var STOCKTYPEData = [{ "Name": "有货" }, { "Name": "清库" }, { "Name": ""}];
var storeSTOCKTYPE = Ext.create('Ext.data.Store', {
model: 'STOCKTYPE',
data: STOCKTYPEData
});
this.comboxSTOCKTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '库存状态',
forceSelection: true,
store: storeSTOCKTYPE,
name: 'STOCKTYPE',
valueField: 'Name',
displayField: 'Name'
});
Ext.define('FeeTypeMd', {
extend: 'Ext.data.Model',
fields: [
{ name: 'FeeTypeID', type: 'string' },
{ name: 'FeeTypeName', type: 'string' }
]
});
var FeeTypeData = [{ "FeeTypeID": "1", "FeeTypeName": "收" },
{ "FeeTypeID": "2", "FeeTypeName": "付" }];
this.storeFeeType = Ext.create('Ext.data.Store', {
model: 'FeeTypeMd',
data: FeeTypeData
});
this.comboxFeeTypeRef = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel:'<font color=red style="font-weight: bold;">收付类型</font>',
store: this.storeFeeType,
name: 'FEETYPE',
valueField: 'FeeTypeID',
displayField: 'FeeTypeName'
});
//#endregion
//#region 查询条件布局
this.formSearch = Ext.widget('form', {
frame: true,
region: 'north',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustomer, {
fieldLabel: '<font color=red style="font-weight: bold;">对账日期</font>', //对账日期
format: 'Y-m-d',
xtype: 'datefield',
name: 'WMSDATE_min',
listeners: {
blur: function (_df) {
var value = _df.getRawValue();
Ext.getCmp('STARTBILLINGDATE').setValue(value);
}
}
}, {
fieldLabel: '<font color=red style="font-weight: bold;">...到</font>',
format: 'Y-m-d',
xtype: 'datefield',
name: 'WMSDATE_max',
listeners: {
blur: function (_df) {
var value = _df.getRawValue();
Ext.getCmp('ENDBILLINGDATE').setValue(value);
}
}
}, this.comboxFeeTypeRef,{
xtype: 'button',
width: 90,
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '编号',
name: 'BLNO', flex: 1
}, this.comboxStock
//, this.comboxSTOCKTYPE
, {
fieldLabel: '品名',
name: 'GOODSNAME'
}, {
fieldLabel: '型号',
name: 'GOODSMODEL'
}, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCHARGEUNIT,{
fieldLabel: '规格',
name: 'GOODSSTANDARD'
}, {
fieldLabel: '等级',
name: 'GOODSGRADE'
}, {
xtype: 'hiddenfield'
}, {
xtype: 'hiddenfield',
flex:0.27
}]
}]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#region 仓储费列表
//#region 定义数据集
this.storeWmsRateDetailList = Ext.create('Ext.data.Store', {
model: 'WmsRateDetailModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/WMSOUT_GuiGe/GetSettleRateDetailList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 仓储费用明细列定义
this.girdcolumsWmsRateDetail = [
{
sortable: false,
dataIndex: 'GID',
header: '', //唯一编码
hidden: true,
width: 0
},
{
sortable: false,
dataIndex: 'FEETYPENAME',
header: '费用类别',
align: 'center',
width: 60
},
{
sortable: false,
dataIndex: 'FEEGRADE',
header: '计费等级',
align: 'center',
width: 60
},
{
sortable: false,
dataIndex: 'STARTBILLINGDATE',
header: '开始计费日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'ENDBILLINGDATE',
header: '结束计费日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
align: 'center',
width: 100
},
{
sortable: false,
dataIndex: 'FEESCALE',
header: '计费区间',
align: 'center',
width: 60
}
// ,
// {
// sortable: false,
// dataIndex: 'FEEUNIT',
// header: '计费单位',
// align: 'center',
// width: 60
// }
,
{
sortable: false,
dataIndex: 'FEEPRICE',
header: '计费单价',
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: false,
dataIndex: 'GOODSPFSL',
header: '计费量',
align: 'center',
width: 80
},
{
sortable: false,
dataIndex: 'OUTFEE',
header: '仓储费',
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: false,
dataIndex: 'WMSOUTGID',
header: 'WMSOUTGID',
hidden: true,
align: 'center',
width: 0
},
{
sortable: false,
dataIndex: 'LINENUM',
header: 'LINENUM',
hidden: true,
align: 'center',
width: 0
},
{
sortable: false,
dataIndex: 'WMSOUTGID',
header: 'WMSOUTGID',
hidden: true,
align: 'center',
width: 0
},
{
sortable: false,
dataIndex: 'ASSOCIATEDNO',
header: '关联号',
hidden: true,
align: 'center',
width: 0
}];
//#endregion
//#region gridList列表显示信息
this.gridListWmsRateDetail = new Ext.grid.GridPanel({
title: "仓储费用明细",
region: 'south',
store: this.storeWmsRateDetailList,
enableHdMenu: false, //是否显示表格列的菜单
hideHeaders: false, //是否隐藏表头
enableColumnHide: false, ///隐藏表头列
sortableColumns: false, ///隐藏表头排序
//disableSelection: false, //是否禁止选择表格行或列默认为false
//trackMouseOver: true, //高亮显示鼠标所在的行默认为true,
//stripeRows: true, //斑马线效果
rowLines: true,
columnLines: true,
loadMask: { msg: "数据加载中,请稍等..." },
selType: 'cellmodel',
height: 200,
columns: this.girdcolumsWmsRateDetail
});
this.paneladddetail = new Ext.Panel({
layout: "border",
region: 'center',
items: [this.gridMblnoList, this.gridAddList, this.gridListWmsRateDetail]
});
this.panelSearch = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
autoSize: true,
hidden: true,
items: [this.formSearch]
});
this.paneladd = new Ext.Panel({
title: '账单明细', //添加账单明细
layout: "border",
region: 'center',
split: true,
height: 300,
items: [
this.panelSearch, this.paneladddetail
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 105,
items: [this.panelBtn, this.formEdit]
});
Ext.apply(this, {
items: [this.panelTop, this.paneladd]
});
//#endregion
//绑定查询窗体
this.ParentWin = window.parent.opener;
//初始化数据
this.InitData();
//绑定事件
var GID = '*';
this.setBtn();
//#region 调用账单明细
this.storeBodyList.load({
timeout: 6000000, //60秒,
params: { condition: " GID='" + GID + "'" }
});
this.storeBodyList.on('beforeload', function (store) {
var sql = " GID='" + GID + "'";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
//#endregion
//#region 调用查询条件
this.storeBodyAddList.on('beforeload', function (store) {
var sql = this.getCondition();
var form = this.formSearch.getForm();
Ext.apply(store.proxy.extraParams, { condition: this.BillSql, duicondition: this.DuiBillSql });
}, this);
this.storeBodyAddList.on('load', function (store, records) {
if (store.getCount() > 0) {
this.gridAddList.getSelectionModel().select(0);
}
}, this);
this.gridAddList.getSelectionModel().on('select', function (model, record, index) {
var outgid = record.data.GID_LINK;
var CUSTOMERNAME = record.data.CUSTOMERNAME;
if (outgid.toString().trim() != "") {
var sql = " AND WMSOUTBSNO='" + outgid + "' and CUSTOMERNAME='" + CUSTOMERNAME + "'";
//this.storeAddFeeList.load({ params: { condition: sql, condition2: this.opStatus} });
}
}, this);
this.gridMblnoList.getSelectionModel().on('select', function (model, record, index) {
var DUIGID = record.data.DUIGID;
var mblno = record.data.BLNO;
var CUSTOMNO = record.data.CUSTOMNO;
var CONTRACTNO = record.data.CONTRACTNO;
var CUSTOMERNAME = record.data.CUSTOMERNAME;
var GOODSNAME = record.data.GOODSNAME;
//
var sql = "";
if (DUIGID.toString().trim() != "") {
sql += " AND DUIGID='" + DUIGID + "'";
}
if (mblno.toString().trim() != "") {
sql += " AND blno='" + mblno + "'";
}
if (CUSTOMNO.toString().trim() != "") {
sql += " AND CUSTOMNO='" + CUSTOMNO + "'";
}
if (CONTRACTNO.toString().trim() != "") {
sql += " AND CONTRACTNO='" + CONTRACTNO + "'";
}
if (CUSTOMERNAME.toString().trim() != "") {
sql += " AND CUSTOMERNAME='" + CUSTOMERNAME + "'";
}
if (GOODSNAME.toString().trim() != "") {
sql += " AND GOODSNAME='" + GOODSNAME + "'";
}
//
if (sql.toString().trim() != "") {
this.storeBodyAddList.load({
timeout: 6000000, //60秒,
params: { condition: sql, condition2: this.opStatus }
});
}
}, this);
this.gridMblnoList.on('cellclick', function (button, event) {
var selectedRecords = this.gridMblnoList.selModel.getSelection(); //选中行
var strBLNOAll = "";
var strCONTRACTNOAll = "";
var strCUSTOMNOAll = "";
var strCUSTOMERNAMEAll = "";
var strGOODSNAMEAll = "";
var strDUIGID = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
strDUIGID = "'" + rec.get('DUIGID') + "'";
//
if (strBLNOAll == "") {
strBLNOAll = "'" + rec.get('BLNO') + "'";
strCONTRACTNOAll = "'" + rec.get('CONTRACTNO') + "'";
strCUSTOMNOAll = "'" + rec.get('CUSTOMNO') + "'";
strCUSTOMERNAMEAll = "'" + rec.get('CUSTOMERNAME') + "'";
strGOODSNAMEAll = "'" + rec.get('GOODSNAME') + "'";
}
else {
strBLNOAll += ",'" + rec.get('BLNO') + "'";
strCONTRACTNOAll += ",'" + rec.get('CONTRACTNO') + "'";
strCUSTOMNOAll += ",'" + rec.get('CUSTOMNO') + "'";
strCUSTOMERNAMEAll += ",'" + rec.get('CUSTOMERNAME') + "'";
strGOODSNAMEAll += ",'" + rec.get('GOODSNAME') + "'";
}
}
var strSql = "";
if (strBLNOAll.trim() != "") {
strSql += " and BLNO in (" + strBLNOAll + ")";
}
else {
strSql = " and 1<0";
}
if (strCONTRACTNOAll.trim() != "") {
strSql += " and CONTRACTNO in (" + strCONTRACTNOAll + ")";
}
else {
strSql = " and 1<0";
}
if (strCUSTOMNOAll.trim() != "") {
strSql += " and CUSTOMNO in (" + strCUSTOMNOAll + ")";
}
else {
strSql = " and 1<0";
}
if (strCUSTOMERNAMEAll.trim() != "") {
strSql += " and CUSTOMERNAME in (" + strCUSTOMERNAMEAll + ")";
}
else {
strSql = " and 1<0";
}
if (strGOODSNAMEAll.trim() != "") {
strSql += " and GOODSNAME in (" + strGOODSNAMEAll + ")";
}
else {
strSql = " and 1<0";
}
if (strDUIGID.trim() != "") {
strSql += " and DUIGID in (" + strDUIGID + ")";
}
}, this);
this.gridAddList.getSelectionModel().on('select', function (model, record, index) {
//var sql = " ASSOCIATEDNO='" + record.data.GID + "' and FEETYPE ='" + this.getFeeType() + "'";
var sql = " ASSOCIATEDNO='" + record.data.GID + "' ";
this.storeWmsRateDetailList.load({ params: { condition: sql } });
}, this);
//#endregion
}, //end initUIComponents
//#endregion
setBtn:function(){
if (this.opStatus == 'edit') {
GID = this.editRecord.get('GID');
this.panelSearch.hide();
Ext.getCmp('btsave').setVisible(false);
Ext.getCmp('btsave2').setVisible(false);
//
Ext.getCmp('btdel').setVisible(true);
Ext.getCmp('btdetaildel').setVisible(true);
}
else {
this.panelSearch.show();
Ext.getCmp('btsave').setVisible(true);
Ext.getCmp('btsave2').setVisible(false);
Ext.getCmp('btdel').setVisible(false);
Ext.getCmp('btdetaildel').setVisible(false);
};
},
//#region 初始化数据函数
InitData: function () {
this.opStatus = 'add';
var condition = '';
var GID = "";
if (this.ParentWin) {
var ret = this.ParentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
}
if (this.opStatus == 'edit') {
condition = " GID='" + this.editRecord.get('GID') + "'";
GID = this.editRecord.get('GID');
//condition = " DUINO='" + this.editRecord.get('DUINO') + "'";
}
this.setFeeType();
this.LoadData(this.opStatus, condition, GID);
}, //end InitData
LoadData: function (opstatus, condition, GID) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/RptWmsSettle/GetData',
params: {
handle: opstatus,
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
var data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
//加载明细表
if (opstatus == "edit") {
var sql = opstatus;
var sql2 = "DUIGID='" + GID + "'";
var DUIGID = " and DUIGID='" + GID + "'";
this.storeMblnoList.load({
timeout: 6000000, //60秒,
params: { start: 0, limit: this.PageSize, sort: '', condition: 'edit', condition2: sql2, condition3: '', condition4: '', strSTARTBILLINGDATE: '', strENDBILLINGDATE: '' },
waitMsg: "正在查询数据...",
callback: function (r, options, success) {
if (success) {
var sql = " AND 1<0";
this.storeBodyAddList.load({
timeout: 6000000, //60秒,
params: { condition: sql, condition2: "edit" }
});
//this.storeAddFeeList.load({ params: { condition: sql, condition2: "edit"} });
}
},
scope: this
});
}
}, // end LoadDate
//#endregion
//#region 按钮事件
//#region 0-保存1-保存并关闭2-保存并新建
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
//
var selectedRecords = this.gridMblnoList.selModel.getSelection();
var strBLNOs = "";
var strCONTRACTNOs = "";
var strCUSTOMNOs = "";
var strCUSTOMERNAMEs = "";
var strGOODSNAMEs = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (strBLNOs == "") {
strBLNOs = "'" + rec.get('BLNO') + "'";
strCONTRACTNOs = "'" + rec.get('CONTRACTNO') + "'";
strCUSTOMNOs = "'" + rec.get('CUSTOMNO') + "'";
strCUSTOMERNAMEs = "'" + rec.get('CUSTOMERNAME') + "'";
strGOODSNAMEs = "'" + rec.get('GOODSNAME') + "'";
}
else {
strBLNOs += ",'" + rec.get('BLNO') + "'";
strCONTRACTNOs += ",'" + rec.get('CONTRACTNO') + "'";
strCUSTOMNOs += ",'" + rec.get('CUSTOMNO') + "'";
strCUSTOMERNAMEs += ",'" + rec.get('CUSTOMERNAME') + "'";
strGOODSNAMEs += ",'" + rec.get('GOODSNAME') + "'";
}
}
var sql = "";
if (strBLNOs.trim() != "") {
sql += " and BLNO in (" + strBLNOs + ")";
}
if (strCONTRACTNOs.trim() != "") {
sql += " and CONTRACTNO in (" + strCONTRACTNOs + ")";
}
if (strCUSTOMNOs.trim() != "") {
sql += " and CUSTOMNO in (" + strCUSTOMNOs + ")";
}
if (strCUSTOMERNAMEs.trim() != "") {
sql += " and CUSTOMERNAME in (" + strCUSTOMERNAMEs + ")";
}
if (strGOODSNAMEs.trim() != "") {
sql += " and GOODSNAME in (" + strGOODSNAMEs + ")";
}
//
var data = basicForm.getValues();
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/RptWmsSettle/Save',
scope: this,
params: {
condition: sql,
opstatus: this.opStatus,
data: Ext.JSON.encode(data)
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
if (this.opStatus == 'add') {
}
else if (this.opStatus == 'edit') {
this.editRecord.commit();
}
if (type == '0') {
this.opStatus = 'edit';
this.setBtn();
} else if (type == '1') {
window.close();
} else {
this.LoadData('add', '');
this.setBtn();
}
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
},
//#endregion
gridAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
},
//#region 执行查询
onRefreshClick: function (button, event) {
var sql = this.getCondition();
var sql2 = this.getCondition2();
var sql3 = this.getCondition3();
var sql4 = this.getCondition4();
var strSTARTBILLINGDATE = this.getSTARTBILLINGDATE();
var strENDBILLINGDATE = this.getENDBILLINGDATE();
var strFeeType = this.getFeeType();
if (sql != "" || sql2 != "" || sql3 != "" || sql4 != "") {
Ext.Ajax.timeout = 6000000;
//url: '/MvcShipping/RptWmsSettle/GetBLListData',
this.storeMblnoList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql, condition2: sql2, condition3: sql3, condition4: sql4, strSTARTBILLINGDATE: strSTARTBILLINGDATE, strENDBILLINGDATE: strENDBILLINGDATE,strFeeType:strFeeType },
waitMsg: "正在查询数据...",
timeout: 6000000, //60秒,
callback: function (r, options, success) {
if (success) {
var sql = " AND 1<0";
this.storeBodyAddList.load({
timeout: 6000000, //60秒,
params: { condition: sql, condition2: "edit" }
});
}
},
scope: this
});
}
},
//#endregion
//#region 重置条件
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
this.storeMblnoList.removeAll();
this.storeBodyAddList.removeAll();
this.storeWmsRateDetailList.removeAll();
},
//#endregion
//#region 查询条件赋值
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
//var WMSDATE_min = form.findField('WMSDATE_min').getRawValue();
//sql = sql + getAndConSql(sql, WMSDATE_min, "CONVERT(char(10), WMSDATE, 120) >= '" + WMSDATE_min + "'");
//var WMSDATE_max = form.findField('WMSDATE_max').getRawValue();
//sql = sql + getAndConSql(sql, WMSDATE_max, "CONVERT(char(10), WMSDATE, 120) <= '" + WMSDATE_max + "'");
return sql;
},
//查询条件提取2
getCondition2: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var WMSDATE_min = form.findField('WMSDATE_min').getRawValue();
var WMSDATE_max = form.findField('WMSDATE_max').getRawValue();
sql = sql + getAndConSql(sql, WMSDATE_min, "CONVERT(char(10), DODATE_OUT, 120) >= '" + WMSDATE_min + "'");
sql = sql + getAndConSql(sql, WMSDATE_max, "CONVERT(char(10), DODATE_OUT, 120) <= '" + WMSDATE_max + "'");
return sql;
},
//查询条件提取4
getCondition4: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var WMSDATE_max = form.findField('WMSDATE_max').getRawValue();
var FeeType = form.findField('FEETYPE').getValue();
if (FeeType == '付')
sql = sql + getAndConSql(sql, WMSDATE_max, "CONVERT(char(10), STARTBILLINGDATEAP, 120) <= '" + WMSDATE_max + "'");
sql = sql + getAndConSql(sql, WMSDATE_max, "CONVERT(char(10), STARTBILLINGDATE, 120) <= '" + WMSDATE_max + "'");
return sql;
},
//查询条件提取3
getCondition3: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
//查询条件
var sql = " CORPID='" + COMPANYID + "'";
var BLNO = form.findField('BLNO').getValue();
sql = sql + getAndConSql(sql, BLNO, "(BLNO like '%" + BLNO + "%' or CUSTOMNO like '%" + BLNO + "%' or CONTRACTNO like '%" + BLNO + "%')");
var WMSDATE_min = form.findField('WMSDATE_min').getRawValue();
var WMSDATE_max = form.findField('WMSDATE_max').getRawValue();
//if (typeof (CustomerName) == "undefined" || WMSDATE_min == "" || WMSDATE_max == "") {
if (WMSDATE_min == "" || WMSDATE_max == "") {
Ext.Msg.alert('提示', '请选择对账日期!');
return '';
}
var CustomerName = form.findField('CUSTOMERNAME').getValue();
var FeeType = form.findField('FEETYPE').getValue();
if (FeeType == '2')
sql = sql + getAndConSql(sql, CustomerName, "TRUCKNAME = '" + CustomerName + "'");
else
sql = sql + getAndConSql(sql, CustomerName, "CUSTOMERNAME = '" + CustomerName + "'");
var STORAGENAME = form.findField('STORAGENAME').getValue();
sql = sql + getAndConSql(sql, STORAGENAME, "STORAGENAME = '" + STORAGENAME + "'");
var GOODSNAME = form.findField('GOODSNAME').getValue();
sql = sql + getAndConSql(sql, GOODSNAME, "GOODSNAME like '%" + GOODSNAME + "%'");
var GOODSMODEL = form.findField('GOODSMODEL').getValue();
sql = sql + getAndConSql(sql, GOODSMODEL, "GOODSMODEL like '%" + GOODSMODEL + "%'");
var GOODSSTANDARD = form.findField('GOODSSTANDARD').getValue();
sql = sql + getAndConSql(sql, GOODSSTANDARD, "GOODSSTANDARD like '%" + GOODSSTANDARD + "%'");
var GOODSGRADE = form.findField('GOODSGRADE').getValue();
sql = sql + getAndConSql(sql, GOODSGRADE, "GOODSGRADE like '%" + GOODSGRADE + "%'");
var CHARGEUNIT = form.findField('CHARGEUNIT').getValue();
sql = sql + getAndConSql(sql, CHARGEUNIT, "CHARGEUNIT = '" + CHARGEUNIT + "'");
return sql;
},
//查询条件_开始计费日期
getSTARTBILLINGDATE: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var STARTBILLINGDATE = form.findField('WMSDATE_min').getRawValue();
return STARTBILLINGDATE;
},
//查询条件_结束计费日期
getENDBILLINGDATE: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var ENDBILLINGDATE = form.findField('WMSDATE_max').getRawValue();
return ENDBILLINGDATE;
},
//查询条件_收付类型
getFeeType: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var FEETYPE = form.findField('FEETYPE').getValue();
return FEETYPE;
},
setFeeType: function () {
var form = this.formSearch.getForm();
form.findField('FEETYPE').setValue('1');
},
//#endregion
//#region 打印
Print: function () {
var basicForm = this.formEdit.getForm();
var billNo = basicForm.findField('DUINO').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'WMSDUI';
var sql1 = " SELECT GID, DUIGID, DUINO, BLNO, CUSTOMNO, CONTRACTNO,WMSNO, OUTBSNO, CUSTOMERNAME,STORAGENAME , GOODSNAME, GOODSMODEL , GOODSSTANDARD, GOODSGRADE ,dbo.trimdate(WMSDATE) as WMSDATE, dbo.trimdate(DODATE) as DODATE,GOODSPACK, GOODSPACKACTUAL, GOODSPACKPFSL, GOODSPACKSTOCK,GOODSRKSL, GOODSRKSLACTUAL, GOODSPFSL, GOODSSTOCK,CHARGEUNIT,FEETYPE,dbo.trimdate(STARTBILLINGDATE) as STARTBILLINGDATE,dbo.trimdate(ENDBILLINGDATE) as ENDBILLINGDATE, FEEDAYS, OUTFEE,CREATEUSER , CREATETIME,LINENUM,GID_LINK FROM wms_settle_detail where DUINO='" + billNo + "' and ISDELETE=0 order by BLNO,DODATE";
//sql1 += " WMSNO, OUTBSNO, CUSTOMERNAME,";
//sql1 += " STORAGENAME , GOODSNAME , GOODSMODEL , GOODSSTANDARD , GOODSGRADE ,";
// sql1 += " dbo.trimdate(WMSDATE) as WMSDATE, dbo.trimdate(DODATE) as DODATE,"
//sql1 += " GOODSPACK, GOODSPACKACTUAL, GOODSPACKPFSL, GOODSPACKSTOCK,";
// sql1 += " GOODSRKSL, GOODSRKSLACTUAL, GOODSPFSL, GOODSSTOCK ,";
// sql1 += " CHARGEUNIT, FEETYPE,";
// sql1 += " dbo.trimdate(STARTBILLINGDATE) as STARTBILLINGDATE,";
//sql1 += " dbo.trimdate(ENDBILLINGDATE) as ENDBILLINGDATE, FEEDAYS, OUTFEE,";
//sql1 += " CREATEUSER , CREATETIME,LINENUM,GID_LINK ";
// sql1 += " FROM wms_settle_detail where DUINO='" + billNo + "' and ISDELETE=0";
/*
var sql1 =" SELECT GID as 唯一编号, DUIGID as 对账GID, DUINO as 对账编号, BLNO as 提单号, CUSTOMNO as 备案清单号, CONTRACTNO as 合同号,";
sql1 +=" WMSNO as 入库单号, OUTBSNO as 出库单号, CUSTOMERNAME as 客户名称,";
sql1 +=" STORAGENAME as 仓库名称, GOODSNAME as 品名, GOODSMODEL as 型号, GOODSSTANDARD as 规格, GOODSGRADE as 等级,";
sql1 +=" dbo.trimdate(WMSDATE) 入库日期, dbo.trimdate(DODATE) as 出库日期,"
sql1 +=" GOODSPACK as 入库件数, GOODSPACKACTUAL as 入库实际件数, GOODSPACKPFSL as 出库件数, GOODSPACKSTOCK as 库存件数,";
sql1 +=" GOODSRKSL as 入库量, GOODSRKSLACTUAL as 入库实际量, GOODSPFSL 出库量, GOODSSTOCK as 库存量,";
sql1 +=" CHARGEUNIT as 计费单位, FEETYPE as 收付方向,";
sql1 += " dbo.trimdate(STARTBILLINGDATE) as 开始计费日期,";
sql1 += " dbo.trimdate(ENDBILLINGDATE) as 结束计费日期, FEEDAYS as 计费天数, OUTFEE as 仓储费,";
sql1 +=" CREATEUSER as 创建人员, CREATETIME as 创建时间,LINENUM,GID_LINK ";
sql1 += " FROM wms_settle_detail where DUINO='" + billNo + "' and ISDELETE=0";
*/
var sql2 = "SELECT GID as 惟一值,CODENAME as 客户代码,SHORTNAME as 客户简称,DESCRIPTION as 客户中文名称或描述信息,NAME as 客户英文简称,EnFullName as 客户英文全称,STATUS as 客户状态,ADDR as 通讯地址,EMAIL as 电子邮箱,WEB as 网页,(CASE TEL WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE TEL END) as 电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) as 传真,CHIEF as 负责人,SALE as 所属揽货人,OP as 所属操作,DOC as 所属单证,ISCARRIER as 是否船公司,ISBOOKING as 是否订舱公司,ISYARD as 是否场站,ISTRUCK as 是否车队,ISCONTROLLER as 是否委托单位,ISCUSTOM as 是否报关行,ISAGENT as 是否国外代理,ISAGENTCN as 是否国内代理,ISEXPRESS as 是否快递公司,ISAIRLINES as 是否航空公司,ISSHIPPER as 是否发货人,ISCONSIGNEE as 是否收货人,ISNOTIFYPARTY as 是否通知人,ISWAREHOUSE as 是否仓库,ISINSURE as 是保险公司,ISLEASING as 是租箱公司,ISTRADINGAGENCY as 是否贸易代理,ISOTHER as 其他_,OTHERS as 其他说明,COUNTRY as 国家,PROVINCE as 省或州,CITY as 城市,CORPID as 所属分公司代码,BLCONTENT as 详细信息,ISSTOP as 是否停用该客户信息,BillRises1 as 发票抬头1,BillRises2 as 发票抬头2,RMBBillRises as 人民币支票抬头,RMBBank as 人民币开户银行,RMBAccount as 人民币账号,RMBOnlineNO as 人民币联机行号,USDBillRises as 美元支票抬头,USDBank as 美元开户银行,USDAccount as 美元账号,USDOnlineNO as 美元联机行号,CustomAttributes1 as 自定义属性1,CustomAttributes2 as 自定义属性2,USDMaxAmountCredit as 美元信用最大金额,RMBMaxAmountCredit as 人民币信用最大金额,MaxAmountCredit as 信用最大金额,STLNAME as 结算方式,OPNAME as 处理人,OPTIME as 处理时间,REMARK as 备注,USDExchangeRate as 美金汇率,STLDATE as 月结时间,STLFIRSTHALFDATE as 上半月结时间,STLMIDDLEDATE as 下半月结时间,STLDATEPJ as 票结时间,LEVEL as 运价级别,LOGINNAME as 客户代码名,LOGINPASSWORD as 登录密码,QQ as QQ,MSN as MSN,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = MODIFIEDUSER) as 最后一次更新操作人,MODIFIEDTIME as 最后一次更新操作时间,FARCODE as 财务应收帐款代码,FAPCODE as 财务应付帐款代码 FROM info_client where SHORTNAME in (select CUSTOMERNAME from wms_settle_list WHERE DUINO='" + billNo + "' and ISDELETE=0) and ISSTOP=0 ";
var sql3 = "SELECT u.GID as 惟一编号,u.USERNAME as 英文名,u.PASSWORD as 登录密码,u.CODENAME as 用户代码名,u.SHOWNAME as 显示用户名,u.ENROLLTIME as 注册时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.CREATEUSER) as 操作人,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = u.MODIFIEDUSER) as 更改操作人,u.MODIFIEDTIME as 更改操作时间,u.ISDELETED as 账户删除状态标志,u.ISDISABLE as 账户禁用状态标志,b.COMPANYNAME as 公司简称,b.DEPTNAME as 部门名称,b.QQ as QQ,b.MSN as MSN,(CASE b.OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.OFFICEPHONE END) as 办公电话号码,(CASE b.HOMEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.HOMEPHONE END) as 家庭电话号码,b.MOBILE as 手机号码,(CASE b.FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.FAX END) as 传真号码,b.EMAIL1 as 主电子邮件地址,b.EMAIL2 as 次电子邮件地址,b.HOMEADDRESS as 家庭地址,b.REMARK as 备注信息,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.CREATEUSER) as 创建人,b.CREATETIME as 创建时间,(SELECT TOP (1) SHOWNAME FROM [user] WHERE GID = b.MODIFIEDUSER) as 最后一次操作人,b.MODIFIEDTIME as 最后一次操作时间,b.EMERGUSER as 紧急联系人,(CASE b.EMERGPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE b.EMERGPHONE END) as 紧急联系人联系电话,b.EMERGEMAIL as 紧急联系人邮箱,b.POSTCODE as 邮政编码,b.SIGNATURE as 签名图片,b.FINANCESOFTCODE as 财务软件代码,b.IMAGEURL as 头像url,b.SIGNATUREURL as 签名Url FROM [user] as u INNER JOIN user_baseinfo as b ON u.GID = b.USERID where u.GID='" + USERID + "'";
var sql4 = " SELECT GID as 惟一编号,CODENAME as 公司代码名,NAME as 公司简称,FULLNAME as 公司全称,ENNAME as 公司英文名称,ADDRESS as 公司联络地址,ENADDRESS as 公司英文地址,POSTCODE as 邮政编码,(CASE OFFICEPHONE WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE OFFICEPHONE END) AS 公司办公电话,(CASE FAX WHEN '86-0-0' THEN '' when '86--' then '' when '86' then '' ELSE FAX END) AS 传真号码,EMAIL as 电子邮箱,WEBSITEURL as 公司网址,LICENSECODE as 工商登记号,TAXCODE as 税务登记号,LOGO as 徽标,BillRises as 发票抬头,ChequePayable as 支票抬头,PRTHEADXML1 as 打印抬头1,PRTHEADXML2 as 打印抬头2,PRTHEADXML3 as 打印抬头3,PRTHEADXML4 as 打印抬头4,PRTHEADXML5 as 打印抬头5,CREATEUSER as 创建人gid,CREATETIME as 创建时间,MODIFIEDUSER as 更新人gid,MODIFIEDTIME as 更新时间,ISDELETED as 是否删除,ISDISABLE as 是否被禁用,PARENTID as 父公司GID,BANKSHEAD as 票号头字符 FROM [company] WHERE GID = '" + COMPANYID + "'";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
//#endregion
//#region 删除
onDeleteClick: function (button, event) {
var selectedRecords = this.gridMblnoList.getSelectionModel().getSelection();
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//
var record = selectedRecords[0];
var DUIGID = record.data.DUIGID;
if (DUIGID.trim() != "") {
DUIGID = " and DUIGID='" + DUIGID + "'";
}
//
var selectedRecords = this.gridMblnoList.selModel.getSelection();
var strBLNOs = "";
var strCONTRACTNOs = "";
var strCUSTOMNOs = "";
var strCUSTOMERNAMEs = "";
var strGOODSNAMEs = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (strBLNOs == "") {
strBLNOs = "'" + rec.get('BLNO') + "'";
strCONTRACTNOs = "'" + rec.get('CONTRACTNO') + "'";
strCUSTOMNOs = "'" + rec.get('CUSTOMNO') + "'";
strCUSTOMERNAMEs = "'" + rec.get('CUSTOMERNAME') + "'";
strGOODSNAMEs = "'" + rec.get('GOODSNAME') + "'";
}
else {
strBLNOs += ",'" + rec.get('BLNO') + "'";
strCONTRACTNOs += ",'" + rec.get('CONTRACTNO') + "'";
strCUSTOMNOs += ",'" + rec.get('CUSTOMNO') + "'";
strCUSTOMERNAMEs += ",'" + rec.get('CUSTOMERNAME') + "'";
strGOODSNAMEs += ",'" + rec.get('GOODSNAME') + "'";
}
}
var strSql = "";
if (strBLNOs.trim() != "") {
strSql += " and BLNO in (" + strBLNOs + ")";
}
if (strCONTRACTNOs.trim() != "") {
strSql += " and CONTRACTNO in (" + strCONTRACTNOs + ")";
}
if (strCUSTOMNOs.trim() != "") {
strSql += " and CUSTOMNO in (" + strCUSTOMNOs + ")";
}
if (strCUSTOMERNAMEs.trim() != "") {
strSql += " and CUSTOMERNAME in (" + strCUSTOMERNAMEs + ")";
}
if (strGOODSNAMEs.trim() != "") {
strSql += " and GOODSNAME in (" + strGOODSNAMEs + ")";
}
//
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/RptWmsSettle/Delete_Detail',
params: {
DUIGID: DUIGID,
strBLNOs: strSql,
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
this.storeMblnoList.remove(rec);
}
//
var sql = " AND 1<0";
this.storeBodyAddList.load({
timeout: 6000000, //60秒,
params: { condition: sql, condition2: "edit" }
});
//合计
this.storeListSum.load({
timeout: 6000000, //60秒,
params: { condition: DUIGID, opstatus: 'edit', hjname: '合计金额:' }
});
//this.storeListSumSelect.load({ params: { condition: " and 1<0", opstatus: 'edit', hjname: '当前金额:'} });
this.storeListSumSelectAll.load({
timeout: 6000000, //60秒,
params: { condition: " and 1<0", opstatus: 'edit', hjname: '选中金额:' }
});
Ext.Msg.show({ title: '提示', msg: '删除成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
//#endregion
//#region 删除
,
onDeleteDetailClick: function (button, event) {
var selectedRecords = this.gridAddList.getSelectionModel().getSelection();
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//
var record = selectedRecords[0];
var GID = record.data.GID;
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/RptWmsSettle/Delete_Detail_Detail',
params: {
GID: GID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
condition = " GID='" + this.editRecord.get('GID') + "'";
GID = this.editRecord.get('GID');
this.setFeeType();
this.LoadData(this.opStatus, condition, GID);
Ext.Msg.show({ title: '提示', msg: '删除成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
//#endregion
//#endregion
});