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.

4484 lines
160 KiB
JavaScript

9 months ago
Ext.namespace('Shipping');
Shipping.ImportDeliveryBLEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.ImportDeliveryBLEdit.superclass.constructor.call(this);
};
Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minute
"s+": this.getSeconds(), //second
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
"S": this.getMilliseconds() //millisecond
}
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o) if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
return format;
}
var xhr = new XMLHttpRequest();
var currdate = new Date();
if (!xhr) {
//...其他生成xmlhttprequest方法
}
xhr.open("HEAD", location.href, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
var datestr = xhr.getResponseHeader("Date");
currdate = new Date(datestr);
// alert(currdate.format('yyyy-MM-dd'));
}
}
xhr.send(null);
Ext.extend(Shipping.ImportDeliveryBLEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
addstore: false,
PageSize: 30,
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.FeeSql = '';
this.BillSql = '';
this.DuiBillSql = '';
this.IsDebit = '0';
this.feeBodyDel = [];
this.formname_DeliveryDetail = "formImport_DeliveryDetail"; //页面名称
//#region 编辑form
//#region 枚举参照相关(编辑form)
//表参照相关(编辑form)
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,
//allowBlank: false,
forceSelection: true,
name: 'CUSTOMERNAME', id: "CUSTOMERNAME",
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr.load({ params: { condition: ""} });
this.StoreDateCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeNowCurrList' }
});
this.StoreDateCurr.load({ params: { condition: ""} });
this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
allowBlank: false,
store: this.StoreCurr,
forceSelection: true,
emptyText: '原币申请',
name: 'CURR',
valueField: 'CURR',
displayField: 'CURR'
});
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeOpCode.load();
//采购
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操 作',
store: this.storeOpCode,
forceSelection: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
this.storeOpCode2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeOpCode2.load();
//采购
this.comboxSALER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '销 售',
store: this.storeOpCode2,
forceSelection: true,
name: 'SALER',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
this.storeDeliveryType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeDeliveryType.load({ params: { enumTypeId: 42} });
this.comboxDeliveryType = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '出库类型', id: "DeliveryType",
forceSelection: true,
store: this.storeDeliveryType,
name: 'DeliveryType'
});
//#endregion
//编辑form
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 3,
trackResetOnLoad: true,
// 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: 'GID',
name: 'GID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'CORPID',
name: 'CORPID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'DEPTGID',
name: 'DEPTGID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'TIMEMARK',
name: 'TIMEMARK', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'BSSTATUS', id: "BSSTATUS",
name: 'BSSTATUS', flex: 0, hidden: true, margins: '0'
},
{
fieldLabel: '销售合同号', id: "SALESNO",
readOnly: true,
name: 'SALESNO'
},
{
fieldLabel: '出库单号',
readOnly: true,
name: 'DELIVERYNO'
}
, this.comboxCustCode
, this.comboxOP
//, this.comboxSALER
, {
fieldLabel: '出库日期',
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
name: 'DELIVERYDATE'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '出库联系人',
name: 'CONTACT'
}, {
fieldLabel: '出库联系电话',
name: 'TEL'
}, {
fieldLabel: '车号',
name: 'TRUCKNO'
}, {
fieldLabel: '备注', flex: 2,
name: 'REMARK'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'numberfield',
items: [{
xtype: 'checkbox', flex: 1,
fieldLabel: '已有出库回执',
name: 'OUTRECEIPT'
}, {
xtype: 'checkbox', flex: 1,
fieldLabel: '是否控车',
name: 'SFKC'
}, {
xtype: 'checkbox', flex: 1,
fieldLabel: '是否抄码',
name: 'SFCM'
}, this.comboxDeliveryType
, { xtype: 'hiddenfield', flex: 1}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
//this.UnLockClick();
this.DelWMSOUT();
this.SaveWMSOUT();
},
scope: this
}, '-',
{
text: "打印",
handler: function (button, event) {
this.Print();
},
scope: this
},
'-',
{
id: 'btnESaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('0');
//this.UnLockClick();
this.DelWMSOUT();
this.SaveWMSOUT();
this.Save('1');
},
scope: this
},
'-',
{
id: 'btnESaveAndNew',
text: "保存并新建",
handler: function (button, event) {
this.Save('0');
//this.UnLockClick();
this.DelWMSOUT();
this.SaveWMSOUT();
this.Save('2');
this.GetEditStatus();
},
scope: this
},
'-',
{
id: 'btnENew',
text: "新建",
handler: function (button, event) {
this.LoadData('add', '*');
},
scope: this
}, '-', {
id: 'btnSubmit',
text: '提交入账申请',
tooltip: '提交财务审核',
handler: function (button, event) {
this.Save('0');
this.LockClick();
},
scope: this
}, {
id: 'btnUnSubmit',
text: '撤销入账申请',
tooltip: '取消提交财务。如财务已审核则无法提交。',
handler: function (button, event) {
this.Save('0');
this.UnLockClick();
},
scope: this
}, '-', '-', { xtype: "label", id: "BSSTATUSREF", text: "",
handler: function () { ; }
}, {
id: 'btnLock', hidden: true,
text: '锁定出库单',
tooltip: '注意请先保存好实际出库的件数和重量,否则保存无效',
handler: function (button, event) {
var BSSTATUS = this.formEdit.getForm().findField('BSSTATUS').getValue();
if (BSSTATUS == "1") {
alert("已经锁定的出库单不能再次锁定。");
return;
} else {
this.Save('0');
this.SaveWMSOUT();
}
},
scope: this
}, '-', {
id: 'btnUnLock', hidden: true,
text: '解锁出库单',
tooltip: '撤销审核',
handler: function (button, event) {
//this.UnLockClick();
this.DelWMSOUT();
},
scope: this
}, {
id: 'btntest', hidden: true,
text: '生成出库测试',
tooltip: '生成出库测试',
handler: function (button, event) {
this.SaveWMSOUT();
},
scope: this
}, {
id: 'btntestdel', hidden: true,
text: '删除出库测试',
tooltip: '删除出库测试',
handler: function (button, event) {
this.DelWMSOUT();
},
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 明细表
//明细表表格相关
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//明细表 提货出库单明细
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'ImportDeliveryDetailmb',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/Import/ImportDelivery/GetDetailList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.girdcolums = [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DELIVERYNO',
header: 'DELIVERYNO',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'SALEDETAIL_GID',
header: 'SALEDETAIL_GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'SALESTATUS',
header: 'SALESTATUS',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MAINSTATE',
header: 'MAINSTATE',
width: 80
}, {
sortable: true,
dataIndex: 'HTH',
header: '采购合同号',
width: 80
},
{
sortable: true,
dataIndex: 'CARGONAME',
header: '货物名称',
width: 80
},
{
sortable: true,
dataIndex: 'FACTORYNO',
header: '厂号',
width: 80
},
{
sortable: true, align: 'right',
dataIndex: 'WEIGHT_EX',
header: '预计出库重量(kg)',
width: 100,
editor: {
selectOnFocus: true, align: 'right',
xtype: 'numberfield'
}
},
{
sortable: true, align: 'right',
dataIndex: 'BOXCOUNT_EX',
header: '预计出库件数',
width: 80,
editor: {
selectOnFocus: true, align: 'right',
xtype: 'numberfield'
}
},
{
sortable: true, align: 'right',
dataIndex: 'WEIGHT',
header: '出库重量(kg)',
width: 90,
editor: {
selectOnFocus: true, align: 'right',
xtype: 'numberfield'
}
},
{
sortable: true, align: 'right',
dataIndex: 'BOXCOUNT',
header: '出库件数',
width: 80,
editor: {
selectOnFocus: true, align: 'right',
xtype: 'numberfield'
}
},
{
sortable: true, align: 'right',
dataIndex: 'GOODSSTOCK',
header: '当前库存重量',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 5, '', true);
return value;
}
},
{
sortable: true, align: 'right',
dataIndex: 'GOODSPACKSTOCK',
header: '当前库存件数',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, align: 'right',
dataIndex: 'WEIGHT_REMAIN',
header: '已售未出库重量',
width: 80,
renderer: function (value, p, record) {
return Cut(record.data.WEIGHT_SALE, record.data.WEIGHT_DE, 2);
}
},
{
sortable: true, align: 'right',
dataIndex: 'BOXCOUNT_REMAIN',
header: '已售未出库件数',
width: 80,
renderer: function (value, p, record) {
return Cut(record.data.BOXCOUNT_SALE, record.data.BOXCOUNT_DE, 2);
}
},
{
sortable: true,
dataIndex: 'WEIGHT_SALE',
header: '销售重量(kg)',
width: 80
},
{
sortable: true,
dataIndex: 'BOXCOUNT_SALE',
header: '销售件数',
width: 80
},
{
sortable: true,
dataIndex: 'WEIGHT_DE',
header: '已出库重量(kg)',
width: 80
},
{
sortable: true,
dataIndex: 'BOXCOUNT_DE',
header: '已出库件数',
width: 80
},
{
sortable: true,
dataIndex: 'SALESNO',
header: '销售单号',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 160,
editor: {
xtype: 'textfield'
}
}
];
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
plugins: [this.gridListCellEditing],
tbar: [{
text: '删除出库明细',
tooltip: '删除出库明细',
id: 'btndeldetail',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDeleteClick(button, event, 1);
},
scope: this
}, '-', {
text: '生成应收', hidden: true, //此处改为在提交时生成
tooltip: '根据销售单生成应收费用',
id: 'btnmakefee',
iconCls: "btnadddetail",
handler: function (button, event) {
this.MakeFee(button, event, 1);
},
scope: this
}, {
text: "保存列表样式",
id: "btnSaveTable",
handler: function (button, event) {
//this.column = DsTruck.SaveGridPanel(GID, this.formname, this.gridList.columns, this.column, 1, true);
var tempcolumns = this.gridList.columns;
DsTruck.SaveGridPanel(USERID, this.formname_DeliveryDetail, tempcolumns, this.girdcolums, 0, true);
},
scope: this
}],
columns: [
]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname_DeliveryDetail, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeBodyList, this.girdcolums);
//this.gridList.columns[0] = new Ext.grid.RowNumberer();
////////////////////////////////////////////////
//#region 用于向出库单内添加的销售合同明细
this.storeBodyAddList = Ext.create('Ext.data.Store', {
model: 'ImportSaledetailmb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/ImportSales/GetDetailList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.AddGridCheckBoxModel = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.GridCheckBoxModel2 = 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.GridCheckBoxModel2,
tbar: [{
text: '添加出库',
tooltip: '向出库单内添加货物',
id: "btnaddbill",
iconCls: "btnadddetail",
handler: function (button, event) {
if (USERID == "" || typeof (USERID) == "undefined") {
alert("登录信息不全,请退出重新登录");
return;
} else {
this.Save('0');
this.onAddClick(button, event);
}
},
scope: this
}],
columns: [{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true,
dataIndex: 'SALESNO',
header: '销售单号',
width: 120
},
{
sortable: true, hidden: true,
dataIndex: 'CARGO_GID',
header: 'CARGO_GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
},
{
sortable: true,
dataIndex: 'HTH',
header: '合同号',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '销售客户',
width: 80
},
{
sortable: true,
dataIndex: 'NAME',
header: '货物名称',
width: 80
},
{
sortable: true,
dataIndex: 'WEIGHT_ACT',
header: '实际重量',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'WEIGHT_REMAIN',
header: '剩余可售重量',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BOXCOUNT_REMAIN',
header: '剩余可售件数',
width: 80
},
{
sortable: true,
dataIndex: 'WEIGHT',
header: '销售重量',
width: 80
},
{
sortable: true,
dataIndex: 'BOXCOUNT',
header: '销售件数',
width: 80
},
{
sortable: true,
dataIndex: 'Delivery_Weight',
header: '已做出库重量',
width: 80
},
{
sortable: true,
dataIndex: 'Delivery_Boxcount',
header: '已做出库件数',
width: 80
},
{
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 80
},
{
sortable: true,
dataIndex: 'PRICE',
header: '单价(kg)',
width: 80
},
{
sortable: true,
dataIndex: 'AMOUNT',
header: '金额',
width: 80
},
{
sortable: true,
dataIndex: 'EXCHANGERATE',
header: '汇率',
width: 80
},
{
sortable: true,
dataIndex: 'AMOUNTRMB',
header: 'RMB金额',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80
}]
});
/*
*/
_this = this;
this.CurrGroup = new Ext.form.RadioGroup({
id: 'CurrGroup',
xtype: 'radiogroup',
fieldLabel: '折算币别',
columns: 2,
items: [
{ boxLabel: 'RMB', name: 'Curr', inputValue: 'RMB', checked: true },
{ boxLabel: 'USD', name: 'Curr', inputValue: 'USD' }
]
});
//#endregion
//#region 添加费用列表
this.storeAddFeeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'Chfee_add_detail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_ForeignPay/GetFeeDetailList',
reader: {
id: 'CH_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.AddFeeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.cellEditingFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
listeners: {
'edit': function (editor, e) {
}
}
});
this.gridAddFeeList = new Ext.grid.GridPanel({
store: this.storeAddFeeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingFee],
selModel: this.AddFeeGridCheckBoxModel,
tbar: [{
text: '添加申请费用明细',
tooltip: '添加申请费用明细',
iconCls: "btnadddetail",
id: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'CH_ID',
header: 'CH_ID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 100
}, {
sortable: false,
dataIndex: 'CustomerName',
header: '客户名称',
width: 90
}, {
sortable: false,
dataIndex: 'FeeType_Ref',
header: '收付',
width: 40
}, {
sortable: false,
dataIndex: 'FeeName',
header: '费用名称',
width: 70
}, {
sortable: false,
dataIndex: 'Amount',
header: '金额',
width: 70
}, {
sortable: false,
dataIndex: 'Currency',
header: '币别',
width: 40
}, {
sortable: false,
dataIndex: 'BalAmount',
header: '未结金额',
width: 70
}, {
sortable: false,
dataIndex: 'StlAmount',
header: '本次结算金额',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
allowDecimals: true,
decimalPrecision: 2,
selectOnFocus: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(9)
} else if (e.getKey() == 38) {
_this.onUpKeyClick(9)
}
}
}
},
width: 70
}, {
sortable: false,
dataIndex: 'ExChangerate',
header: '原始汇率',
width: 60
}, {
sortable: false,
dataIndex: 'Invoice',
header: '开票金额',
width: 60
}
],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeAddFeeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.gridAddFeeList.on('edit', function (editor, e, eOpts) {
this.gridAddFeeListAfterEdit(editor, e, eOpts);
}, this);
this.storeSelectSum = Ext.create('Ext.data.Store', {
model: 'Chfee_do_selectsum'
});
this.gridSelectSum = new Ext.grid.GridPanel({
store: this.storeSelectSum,
enableHdMenu: false,
// anchor: '100% 50%',
region: 'south',
height: 80,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
tbar: [{
xtype: 'label',
width: 220,
id: 'SelectGrid',
height: 22,
text: '所选费用合计'
}],
columns: [{
sortable: true,
dataIndex: 'RMBDRAMOUNT',
header: 'RMB未收',
width: 80
}, {
sortable: true,
dataIndex: 'RMBCRAMOUNT',
header: 'RMB未付',
width: 80
}, {
sortable: true,
dataIndex: 'USDDRAMOUNT',
header: 'USD未收',
width: 80
}, {
sortable: true,
dataIndex: 'USDCRAMOUNT',
header: 'USD未付',
width: 80
}, {
sortable: true,
dataIndex: 'OTDRAMOUNT',
header: '其他未收',
width: 80
}, {
sortable: true,
dataIndex: 'OTCRAMOUNT',
header: '其他未付',
width: 80
}
]
});
//#endregion
_this = this;
this.storeCustCodefee = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomInvRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomInvRefList' }
});
this.storeCustCodefee.load({ params: { condition: ""} });
this.comboxAddCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户名称',
store: this.storeCustCodefee,
forceSelection: true,
name: 'CUSTNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.StoreOpLb = Ext.create('Ext.data.Store', {
fields: ['OPLBNAME']
});
this.storeAddDCType = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeAddDCType.add({ "DC": "", "NAME": "全部" });
this.storeAddDCType.add({ "DC": "1", "NAME": "应收" });
this.storeAddDCType.add({ "DC": "2", "NAME": "应付" });
this.comboxaddDCType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '收/付',
store: this.storeAddDCType,
valueField: 'DC',
displayField: 'NAME',
forceSelection: true,
name: 'DC',
value: '2',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxCurr2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
store: this.StoreCurr,
forceSelection: true,
name: 'Currency',
valueField: 'CURR',
displayField: 'CURR',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRef.load({ params: { condition: ""} });
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '费用名称',
store: this.storeFeeNameRef,
forceSelection: true,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeFeeCheck = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeCheck.load({ params: { condition: " name in ( select name from code_fee where feegroup in(select feeName from code_PROFIT where FEEGROUP='冷藏')) "} });
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb', proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
});
this.storeCompany.load({ params: { condition: ""} });
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '分公司',
forceSelection: true,
store: this.storeCompany,
name: 'company',
valueField: 'gid',
displayField: 'name'
});
this.storeport = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeport.load({ params: { enumTypeId: 10} });
this.comboxport = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '目的港',
forceSelection: true,
store: this.storeport,
name: 'port',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.storeCustCode2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode2.load({ params: { condition: ""} });
this.comboxCustCode2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '购货单位',
store: this.storeCustCode2,
//allowBlank: false,
forceSelection: true,
name: 'CUSTOMERNAME', id: "CUSTOMERNAME2",
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeCurrExrate = Ext.create('Ext.data.Store', {
fields: ['CURR', 'EXRATE', 'DFEXRATE']
});
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: [
{
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
fieldLabel: '合同号',
name: 'HTH',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '销售单号',
name: 'SALESNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '货物名称',
name: 'CARGONAME',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'hiddenfield', flex: 2
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'button',
width: 90,
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}
, this.comboxCustCode2
, {
xtype: 'hiddenfield', flex: 4
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion 明细表
//#region 费用列表
this.storeFeeTypeRef = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeFeeTypeRef.load({ params: { enumTypeId: 99020} });
this.comboxFeeTypeRef = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeFeeTypeRef,
name: 'FeeType'
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.FeeTypeRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetFeeTypeRefList' }
});
this.storeFeeNameRef.load({ params: { condition: ""} });
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef,
forceSelection: true,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName'
});
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustomerNameRef.load({ params: { condition: ""} });
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCustomerNameRef,
forceSelection: true,
allowBlank: false,
name: 'CustomerName',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//明细表-数据集
this.storeBodyChFee = Ext.create('Ext.data.Store', {
model: 'MsChFee_Sales',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/Import/ImportDelivery/GetFeeList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.cellEditingChFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.feeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridListChFee = new Ext.grid.GridPanel({
store: this.storeBodyChFee,
enableHdMenu: false,
layout: "border",
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingChFee],
selModel: this.feeGridCheckBoxModel,
selType: 'cellmodel',
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
viewConfig: {
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FeeStatus');
return DsTruck.MsChFeeGetRowClass(feeStatus);
}
},
tbar: [{ xtype: 'label', id: 'label1', text: "应收应付费用" }, '-', {
text: '增加明细', hidden: true,
tooltip: '增加明细', id: "addChfee",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddFeeClick(button, event);
},
scope: this
}, {
text: '删除明细', hidden: true,
tooltip: '删除明细', id: "delChfee",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelFeeClick(button, event);
},
scope: this
}, '-', {
id: "btnSave",
text: '保存修改', //hidden: true,
tooltip: '保存修改',
iconCls: "btnsave",
handler: function (button, event) {
this.SaveFee();
//alert(USERID);
},
scope: this
}, {
text: '提交审核', //hidden: true,
tooltip: '提交审核',
iconCls: 'btnsubmitaudit',
handler: function (button, event) {
this.onSubmitAuditClick(button, event);
},
scope: this
}, {
text: '撤回提交', //hidden: true,
tooltip: '撤回提交',
iconCls: 'btncomm',
handler: function (button, event) {
//this.onRetractClick(button, event);
this.onRetractClick(button, event);
},
scope: this
}, { xtype: "label", id: "zongshu", text: "",
handler: function () { ; }
}],
columns: [{
sortable: true, hidden: true,
dataIndex: 'GId',
header: '惟一编号',
width: 160
}, {
sortable: true, hidden: true,
dataIndex: 'BsNo',
header: '业务编号',
width: 200
}, {
sortable: true,
dataIndex: 'FeeStatus',
header: '费用状态',
renderer: function (value, p, record) {
return record.data.FeeStatus_Ref;
},
width: 66
}, {
sortable: true,
dataIndex: 'FeeName',
header: '费用名称',
editor: this.comboxFeeNameRef,
width: 70
}, {
sortable: true,
dataIndex: 'FeeType',
header: '收付方式',
renderer: function (value, p, record) {
if (value == null || value == '')
return '';
else if (value == 1)
return value + '-应收';
else if (value == 2)
return value + '-应付';
},
editor: this.comboxFeeTypeRef,
width: 66
}, {
sortable: true,
dataIndex: 'FeeDescription',
header: '费用英文名称',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'CustomerType',
header: '客户类别',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '结算对象',
editor: this.comboxCustomerNameRef,
width: 120
}, {
sortable: true,
dataIndex: 'Unit',
header: '单位标准',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: '单价',
editor: {
xtype: 'textfield', //numberfield
selectOnFocus: true
},
width: 70
}, {
sortable: true,
dataIndex: 'Quantity',
header: '数量',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 60,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
}, {
sortable: true,
dataIndex: 'Amount',
header: '金额',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
editor: this.comboxcurr_2,
width: 50
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: '汇率',
//hidden: true,
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'EnterDate',
header: '时间',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 250
}, {
sortable: true, hidden: true,
dataIndex: 'SALESNO',
header: 'SALESNO',
width: 100
}
]
});
//#endregion
//#region 预收预付的取用
//待取用的预收明细
this.storeAccBodyList = Ext.create('Ext.data.Store', {
model: 'CWAdvancePaymentmb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_Foreignsettlement/GetAdvancePayment',
reader: {
id: 'BILLNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridListAccCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridListAcc = new Ext.grid.GridPanel({
store: this.storeAccBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListAccCellEditing],
selModel: this.GridAccCheckBoxModel,
tbar: [{
text: '添加取用明细',
tooltip: '添加取用明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddAPDetailClick(button, event);
},
scope: this
}, {
text: '执行查询',
tooltip: '添加申请费用明细',
//iconCls: "btnadddetail",
id: "btnsearch",
handler: function (button, event) {
this.LoadAccBodyList(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'LINKGID',
header: 'LINKGID',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'BILLNO',
header: '结算单号',
width: 120
},
{
sortable: true,
dataIndex: 'FEETYPEREF',
header: '收付',
width: 60
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '结算对象',
width: 100
},
{
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 80
},
{
sortable: true,
dataIndex: 'AMOUNT',
header: '金额',
width: 80
},
{
sortable: true,
dataIndex: 'DOAMOUNT',
header: '已核销金额',
width: 80
},
{
sortable: true,
dataIndex: 'REMAIN',
header: '本次核销',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
allowDecimals: true,
decimalPrecision: 2,
selectOnFocus: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
width: 80
},
{
sortable: true,
dataIndex: 'CREATEUSERREF',
header: '录入人',
width: 80
},
{
sortable: true,
dataIndex: 'CREATETIME',
header: '录入时间',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 120
}
]
});
//预收预付的使用明细
this.storeBodyListAcc = Ext.create('Ext.data.Store', {
model: 'CWAdvancePaymentBodymb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_Foreignsettlement/GetAPBodyList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.GridBodyAccCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridBodyListAcc = new Ext.grid.GridPanel({
store: this.storeBodyListAcc,
enableHdMenu: false,
region: 'center',
//height: 600,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridBodyAccCheckBoxModel,
viewConfig: {
autoFill: true,
enableTextSelection: true
},
tbar: [{
text: '删除取用明细',
tooltip: '删除取用明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onDeleteApClick(button, event);
},
scope: this
}, '-', {
text: '核销费用',
tooltip: '重新生成费用结算。',
//iconCls: "btnadddetail",
handler: function (button, event) {
this.onSettlementClick(button, event);
},
scope: this
}],
columns: [
{
sortable: true,
dataIndex: 'GID',
header: 'GID', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'LINKGID',
header: 'LINKGID', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'BILLNO',
header: '结算单号',
width: 120
},
{
sortable: true,
dataIndex: 'SETTLELINKGID',
header: 'SETTLELINKGID', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'SETTLEBILLNO',
header: '核销使用单号',
width: 120
},
{
sortable: true,
dataIndex: 'FEETYPE',
header: 'FEETYPE',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '结算对象', hidden: true,
width: 100
},
{
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 80
},
{
sortable: true,
dataIndex: 'DOAMOUNT',
header: '核销金额',
width: 80
},
{
sortable: true,
dataIndex: 'SETTLEUSERREF',
header: '核销人',
width: 80
},
{
sortable: true,
dataIndex: 'SETTLETIME',
header: '核销时间',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80
},
{
sortable: true,
dataIndex: 'VOUCHERNO',
header: '凭证号',
width: 80
}
]
});
//#endregion
//#region 明细表-单据档案管理
this.storeReceiptid = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeReceiptid.load({ params: { enumTypeId: 2} });
this.comboxReceiptid = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeReceiptid,
name: 'RECEIPTTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.storeDocList = Ext.create('Ext.data.Store', {
model: 'ReceiptDocmb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/ReceiptDoc/GetDocList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.DocListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.DocCM = Ext.create('Ext.selection.CheckboxModel');
this.gridDocList = new Ext.grid.GridPanel({
store: this.storeDocList,
enableHdMenu: false,
region: 'west',
width: 350,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.DocListCellEditing],
selModel: this.DocCM,
selType: 'cellmodel',
tbar: [{
text: '添加', hidden: true,
tooltip: '添加',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddFileClick(button, event);
},
scope: this
}, '-', {
text: '删除', hidden: true,
tooltip: '删除',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelFileClick(button, event);
},
scope: this
}, '-', {
text: '保存', hidden: true,
tooltip: '保存',
iconCls: "btnsave",
handler: function (button, event) {
this.onPostFileClick(button, event);
},
scope: this
}, '-', {
text: '上传附件', hidden: true,
tooltip: '上传附件',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onUpLoadFileClick(button, event);
},
scope: this
}],
columns: [{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true,
dataIndex: 'RECEIPTTYPE',
header: '单据类型',
editor: this.comboxReceiptid,
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'R_GID',
header: 'R_GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
},
{
sortable: true,
dataIndex: 'URL',
header: '文件名',
width: 140,
editor: {
xtype: 'textfield'
}
},
{
sortable: true, hidden: true,
dataIndex: 'Driect_URL',
header: 'Driect_URL',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDUSER',
header: 'MODIFIEDUSER',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDUSERRef',
header: '修改人',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '修改时间',
width: 85
}
]
});
this.gridDocList.getSelectionModel().on('select', function (model, record, index) {
if (this.Loading == true) {
return;
}
var PICURL = record.data.Driect_URL;
Ext.getCmp('panelPic').body.update(' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + PICURL + '"> </iframe>');
}, this);
//#endregion
//#region 布局
//控件布局
this.panelService = new Ext.Panel({
layout: "border",
region: 'center',
margin: '2 2',
items: [this.gridList]
});
this.panelAddfee = new Ext.Panel({
layout: "border",
region: 'east',
width: 600,
split: true,
margin: '2 2',
items: [this.gridListChFee]
});
this.paneldetail = new Ext.Panel({
title: '销售明细',
layout: "border",
height: 240,
region: "north",
split: true,
items: [
this.panelService, this.panelAddfee
]
});
this.panelAddService = new Ext.Panel({
layout: "border",
region: 'center',
margin: '2 2',
items: [this.gridAddList]
});
this.paneladddetail = new Ext.Panel({
layout: "border",
region: 'center',
height: 300,
items: [this.panelAddService
]
});
this.paneladd = new Ext.Panel({
title: '添加销售明细',
layout: "border",
// region: 'south',
region: "center",
// height: 420,
items: [
this.formSearch, this.paneladddetail
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 150,
items: [this.panelBtn, this.formEdit]
});
this.paneldetailacc = new Ext.Panel({
//预收预付的使用列表
layout: "border",
height: 160,
region: "north",
split: true,
items: [
this.gridBodyListAcc
]
});
this.panelAddacc = new Ext.Panel({
//预收预付列表
layout: "border",
height: 160,
region: "north",
margin: '2 2',
items: [this.gridListAcc]
});
this.panelaccdetail = new Ext.Panel({
title: '认款/确认核销',
layout: "border",
autoScroll: true,
//height: 360,
region: "center",
//split: true,
items: [
this.paneldetailacc, this.panelAddacc
]
});
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center",
split: true,
items: [this.paneladd//, this.panelaccdetail
]
});
this.panelPic = new Ext.Panel({
id: "panelPic",
layout: "fit",
region: "center",
autoScroll: true,
frame: false,
html: ' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + this.PICURL + '"> </iframe>'//ftp://bjes:@120.27.53.37/dhm-11111/2.jpg
});
this.page1 = new Ext.Panel({
layout: "border", title: "销售单明细信息",
region: "center",
items: [this.paneldetail, this.MainTab]
});
this.page2 = new Ext.Panel({
layout: "border", title: "相关采购单附件",
region: "center",
items: [this.gridDocList, this.panelPic]
});
this.tabBottom = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
//border: true,
frame: false,
region: 'center',
//enableTabScroll: true,
items:
[
this.page1
, this.page2
]
});
Ext.apply(this, {
items: [this.panelTop, this.tabBottom]
});
//#endregion
//绑定查询窗体
this.ParentWin = window.parent.opener;
//初始化数据
this.InitData();
//#region绑定事件
var billno = '*';
if (this.opStatus == 'edit') {
billno = this.editRecord.get('BILLNO');
};
this.storeBodyList.on('beforeload', function (store) {
var sql = " BILLNO='" + billno + "'";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeBodyList.on('load', function (store, records) {
if (store.getCount() > 0) {
this.gridList.getSelectionModel().select(0);
}
}, this);
this.gridList.on('edit', function (editor, e, eOpts) {
this.DetailAfterEdit(editor, e, eOpts);
}, this);
this.gridListChFee.on('edit', function (editor, e, eOpts) {
this.gridListChFeeAfterEdit(editor, e, eOpts);
}, this);
//#endregion
this.gridListCellEditing.on('beforeedit', function (editor, e) {
//Ext.getCmp("zongshu").setText("1234");
return this.DetailBeforeEdit(editor, e);
}, this);
this.cellEditingChFee.on('beforeedit', function (editor, e) {
//Ext.getCmp("zongshu").setText("1234");
return this.FeeBeforeEdit(editor, e);
}, this);
}, //end initUIComponents
InitData: function () {
this.opStatus = 'add';
var condition = '';
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') + "'";
this.LoadData(this.opStatus, condition);
}, //end InitData
UnlockInitData: function (DELIVERYNO) {
condition = " DeliveryNo='" + DELIVERYNO + "'";
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
_this = this;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Import/ImportDelivery/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;
if (data.DELIVERYDATE == "") { data.DELIVERYDATE = currdate.format('yyyy-MM-dd hh:mm:ss') };
if (data.OP == "") { data.OP = usercode };
//if (data.BSSTATUS == "") { data.BSSTATUS = "0" };
//if (data.FEESTATUS == "") { data.FEESTATUS = "0" };
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
_this.GetEditStatus();
if (data.BSSTATUS == "0") {
Ext.getCmp("BSSTATUSREF").setText("状态:未提交");
}
if (data.BSSTATUS == "2") {
Ext.getCmp("BSSTATUSREF").setText("状态:已提交");
}
if (data.BSSTATUS == "1") {
Ext.getCmp("BSSTATUSREF").setText("状态:审核通过");
}
if (data.BSSTATUS == "6") {
Ext.getCmp("BSSTATUSREF").setText("状态:驳回提交");
}
billno = data.DELIVERYNO;
SALESNO = data.SALESNO;
this.storeBodyList.load({ params: { condition: " D.DELIVERYNO='" + billno + "'"} });
this.storeBodyChFee.load({ params: { DELIVERYNO: billno },
callback: function (r, options, success) {
if (success) {
if (this.storeBodyList.getCount() > 0) {
//this.comboxCustCode.setReadOnly(true);
}
else {
//this.comboxCustCode.setReadOnly(false);
}
}
},
scope: this
});
var condition2 = " BSNO in(select distinct BSNO from import_saleDetail where salesno= '" + SALESNO + "') ";
this.Loading = true;
this.storeDocList.load({
params: { condition: condition2 },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
this.Loading = false;
}
});
//载入该出库业务结算内的预付费引用
/*
this.storeBodyListAcc.load({ params: { condition: " SETTLEBILLNO='" + billno + "'" },
callback: function (r, options, success) {
if (success) {
//if (_this.storeBodyListAcc.getCount() > 0) (this.comboxCurrADVANCE.readOnly = true)
}
},
scope: this
});
this.setSaveBtnStatus();*/
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var billno = '*';
if (this.opStatus == 'edit') {
billno = this.editRecord.get('DELIVERYNO');
};
/*,
callback: function (r, options, success) {
if (success) {
if (this.storeBodyList.getCount() > 0) {
//this.comboxCustCode.setReadOnly(true);
}
else {
//this.comboxCustCode.setReadOnly(false);
}
}
},
scope: this
});*/
}, // end LoadDate
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var data = basicForm.getValues();
var DELIVERYNO = data.DELIVERYNO;
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
bodydatas.push(member);
}
var jsonDetailBody = ConvertRecordsToJson(bodydatas);
var bodyChFeeDatas = [];
for (i = 0; i < this.storeBodyChFee.getCount(); i += 1) {
var memberyf = this.storeBodyChFee.getAt(i);
bodyChFeeDatas.push(memberyf);
var amount = memberyf.data.Amount;
if (amount == 0) {
Ext.Msg.show({ title: '警告',
msg: '费用的金额不允许为0请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
};
//var jsonChFeeBody = ConvertRecordsToJson(bodyChFeeDatas);
//var jsonChFeeDelBody = ConvertRecordsToJsonAll(this.feeBodyDel);
data.OUTRECEIPT = this.formEdit.getForm().findField('OUTRECEIPT').getValue() ? 1 : 0;
data.SFKC = this.formEdit.getForm().findField('SFKC').getValue() ? 1 : 0;
data.SFCM = this.formEdit.getForm().findField('SFCM').getValue() ? 1 : 0;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
async: false,
url: '/Import/ImportDelivery/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
DeliveryDetailList: jsonDetailBody
},
callback: function (options, success, response) {
if (success) {
this.feeBodyDel = [];
this.storeBodyChFee.commitChanges();
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
this.storeBodyList.commitChanges();
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('ImportDeliverymb', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
if (type == '0') {
this.opStatus = 'edit';
this.storeBodyList.load({ params: { condition: " D.DELIVERYNO='" + DELIVERYNO + "'"} });
} else if (type == '1') {
window.close();
} else {
this.LoadData('add', '');
}
} 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
});
}
}
});
}, //end save
onAddDetailClick: function (button, event) {
this.addstore = true;
this.addDetail();
}, //end onAddDetailClick
onAddBillClick: function (button, event) {
this.addstore = true;
this.addBill();
}, //end onAddDetailClick
onDelDetailClick: function (button, event, type) {
this.deleteDetail();
}, //onDelDetailClick
onAddClick: function (button, event) {
var BSSTATUS = this.formEdit.getForm().findField('BSSTATUS').getValue();
if (BSSTATUS == "1") {
alert("已经锁定的出库单不能更改明细");
return;
}
//传递GID参数
var MainList = "";
selectedRecords = this.gridAddList.selModel.getSelection();
if (selectedRecords.length == 0) {
return;
}
var SALESNO = "";
var formEdit = this.formEdit.getForm();
var SALESNO = formEdit.findField('SALESNO').getValue();
var CUSTOMERNAME = formEdit.findField('CUSTOMERNAME').getValue();
if (CUSTOMERNAME == "") {
selectedRecords = this.gridAddList.selModel.getSelection();
var _CUSTOMERNAME = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
_CUSTOMERNAME = rec.get('CUSTOMERNAME');
}
Ext.getCmp("CUSTOMERNAME").setValue(_CUSTOMERNAME);
}
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (SALESNO == "") {
SALESNO = rec.get('SALESNO');
} else if (SALESNO != rec.get('SALESNO')) {
alert("不能跨销售单选择销售明细");
return;
}
if (MainList == "") { MainList = "'" + rec.get('GID') + "'"; }
else {
MainList = MainList + ",'" + rec.get('GID') + "'";
}
}
var formEdit = this.formEdit.getForm();
var DELIVERYNO = formEdit.findField('DELIVERYNO').getValue();
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ImportDelivery/AddDetail',
scope: this,
params: {
DELIVERYNO: DELIVERYNO,
DetailList: MainList
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
//var data = result.data;
this.storeBodyList.load({ params: { condition: " D.DELIVERYNO='" + DELIVERYNO + "'"} });
Ext.getCmp("SALESNO").setValue(SALESNO);
this.Save('0');
this.onRefreshClick();
var condition2 = " BSNO in(select distinct BSNO from import_saleDetail where salesno= '" + SALESNO + "') ";
this.Loading = true;
this.storeDocList.load({
params: { condition: condition2 },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
this.Loading = false;
}
});
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
},
onDeleteClick: function (button, event) {
var BSSTATUS = this.formEdit.getForm().findField('BSSTATUS').getValue();
if (BSSTATUS == "1") {
alert("已经锁定的出库单不能更改明细");
return false;
}
var MainList = "";
var GID = "";
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('GID') + "'"; }
else {
MainList = MainList + ",'" + rec.get('GID') + "'";
}
}
var formEdit = this.formEdit.getForm();
var DELIVERYNO = formEdit.findField('DELIVERYNO').getValue();
if (MainList == "") {
return;
}
else
Ext.MessageBox.confirm('提示', '确定删除这些记录吗?(注意:有已核销的相关费用的出库明细将无法删除)', function (btn) {
if (btn == 'yes') {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
GID = "'" + rec.get('GID') + "'";
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Import/ImportDelivery/DeleteDetail',
params: {
DELIVERYNO: DELIVERYNO,
GIDList: MainList
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var _this = this;
this.storeBodyList.load({ params: { condition: " D.DELIVERYNO='" + DELIVERYNO + "'" }
, callback: function (options, success, response) {
if (_this.storeBodyList.getCount() == 0)
Ext.getCmp("SALESNO").setValue("");
this.Save('0');
}
});
//Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
//Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
Ext.Msg.hide();
}
},
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);
}, //end onAddDetailClick
gridAddFeeListAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (e.value == e.originalValue) return;
if (e.field == 'StlAmount') {
var BalAmount = e.record.data['BalAmount'];
var StlAmount = e.record.data['StlAmount'];
if (BalAmount >= 0) {
if (StlAmount > BalAmount) {
e.record.set('StlAmount', BalAmount);
Ext.Msg.show({ title: '提示', msg: '申请金额不能大于未申金额!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
if (StlAmount < BalAmount) {
e.record.set('StlAmount', BalAmount);
Ext.Msg.show({ title: '提示', msg: '申请金额不能大于未申金额!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
}
},
onNextKeyClick: function (col) {
var rows = this.gridAddFeeList.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridAddFeeList.getStore();
var number = s.indexOf(row) + 1;
this.cellEditingFee.startEditByPosition({ row: number, column: col });
},
onUpKeyClick: function (col) {
var rows = this.gridAddFeeList.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridAddFeeList.getStore();
var number = s.indexOf(row) - 1;
if (number < 0) number = 0;
this.cellEditingFee.startEditByPosition({ row: number, column: col });
},
DetailBeforeEdit: function (editor, e) {
var BSSTATUS = this.formEdit.getForm().findField('BSSTATUS').getValue();
if (BSSTATUS == "1") {
alert("已经锁定的出库单不能更改明细");
return false;
}
},
FeeBeforeEdit: function (editor, e) {
var chfeefeeStatus = e.record.get('FeeStatus');
var canedit = chfeefeeStatus == 1 || chfeefeeStatus == 6;
return canedit;
},
addDetail: function () {
var BSSTATUS = this.formEdit.getForm().findField('BSSTATUS').getValue();
if (BSSTATUS == "1") {
alert("已经锁定的出库单不能更改明细");
return false;
}
var basicForm = this.formEdit.getForm();
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
_this = this;
if ((Duino == '*') || basicForm.isDirty()) {
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
var CURR = this.formEdit.getForm().findField('CURR').getValue();
if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null)) {
var selectedRecords = this.gridAddFeeList.selModel.getSelection();
if (selectedRecords.length > 0) {
var rec = selectedRecords[0];
var cust = rec.data.CustomerName;
var curr = rec.data.Currency;
if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null))
this.formEdit.getForm().findField('CUSTOMERNAME').setValue(cust);
if ((CURR == '') || (CURR == null))
this.formEdit.getForm().findField('CURR').setValue(curr);
}
}
var STLDATE = this.formEdit.getForm().findField('PAYABLETIME').getValue();
if ((STLDATE == '') || (STLDATE == null)) {
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
this.formEdit.getForm().findField('PAYABLETIME').setValue(mydatestr);
}
if (!basicForm.isValid()) {
return;
}
var type = 0;
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
this.formEdit.getForm().findField('APPLICANT').setDisabled(false);
this.formEdit.getForm().findField('COMPANYID').setDisabled(false);
var data = basicForm.getValues();
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
this.formEdit.getForm().findField('APPLICANT').setDisabled(true);
this.formEdit.getForm().findField('COMPANYID').setDisabled(true);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Account/Chfee_ForeignPay/Save',
scope: this,
params: {
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') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsChPayapplication', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
this.opStatus = 'edit';
_this.addDetailfn();
} 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
});
}
}
});
} else {
this.addDetailfn();
}
},
onSubmitAuditBackClick: function () {
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
if (Duino == '*') {
Ext.Msg.show({ title: '提示', msg: '请先保存付费申请,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if (billstatus != 2) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_ForeignPay/SubmitAuditBack',
params: {
bill: Duino
},
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;
} else {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/Chfee_ForeignPay/GetData',
params: {
handle: 'edit',
condition: " BILLNO='" + Duino + "'"
},
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().findField('BILLSTATUS').setDisabled(false);
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
var editp = Ext.create('MsChPayapplication', data);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
_this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql} });
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var formEdit = this.formEdit.getForm();
var DELIVERYNO = formEdit.findField('DELIVERYNO').getValue();
if (DELIVERYNO == "") {
//this.Save('0');
}
var sql = " s.gid not in (select saledetail_gid from import_deliverydetail where deliveryno='" + DELIVERYNO + "') and ss.SALESTATUS=2 ";
sql = sql + " and s.cargo_gid in(select cargo_gid from wms where goodspackstock<>0 and goodsstock<>0 ) "
var SALESNO = formEdit.findField('SALESNO').getValue();
if (SALESNO != "") {
sql = sql + getAndConSql(sql, SALESNO, " s.SALESNO= '" + SALESNO + "' ");
}
var HTH = form.findField('HTH').getValue();
sql = sql + getAndConSql(sql, HTH, " s.BSNO in(select contractno from import_main where hth like '%" + HTH + "%') ");
var _SALESNO = form.findField('SALESNO').getValue();
sql = sql + getAndConSql(sql, _SALESNO, " s.SALESNO like '%" + _SALESNO + "%' ");
var CARGONAME = form.findField('CARGONAME').getValue();
sql = sql + getAndConSql(sql, CARGONAME, " s.cargo_GID in (select gid from import_cargo where name like '%" + CARGONAME + "%') ");
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, " s.SALESNO in(select SALESNO from import_sales where CUSTOMERNAME like '%" + CUSTOMERNAME + "%') ");
return sql;
},
getFeeCondition: function () {
var form = this.formSearch.getForm();
var feesql = 'f.FEESTATUS IN (0,8,9) and (f.AMOUNT<>(f.SETTLEMENT+f.ORDERAMOUNT-ISNULL(f.ORDERSETTLEMENT,0))) ';
var CUSTNAME = form.findField('CUSTNAME').getValue();
feesql = feesql + getAndConSql(feesql, CUSTNAME, "f.CUSTOMERNAME='" + CUSTNAME + "'");
var DC = form.findField('DC').getValue();
feesql = feesql + getAndConSql(feesql, DC, "f.FEETYPE=" + DC);
var Currency = form.findField('Currency').getValue();
feesql = feesql + getAndConSql(feesql, Currency, "f.Currency='" + Currency + "'");
var FeeName = form.findField('FeeName').getValue();
feesql = feesql + getAndConSql(feesql, FeeName, "f.FeeName='" + FeeName + "'");
return feesql;
},
ExrateConversion: function (bfcurr, afcurr, fntype, dfexrate) {
var EXRATE = 0;
var achange = true;
var bchange = true;
formExrateConversion = Ext.widget('form', {
frame: true,
region: 'center',
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: [{
fieldLabel: '1' + bfcurr + '=',
xtype: 'numberfield',
name: 'bfcurr',
decimalPrecision: 4,
value: 0,
listeners: {
change: function () {
if (bchange) {
var bfcurr = formExrateConversion.getForm().findField('bfcurr').getValue();
var field = formExrateConversion.getForm().findField('afcurr');
if (bfcurr == 0) { field.setValue(0); } else {
var taxrate = (parseFloat(1).div(parseFloat(bfcurr))).toFixed(4);
achange = false;
field.setValue(taxrate);
}
}
achange = true;
}
}
}, {
xtype: 'label',
width: 120,
text: afcurr,
name: 'bfcurr2'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '1' + afcurr + '=',
xtype: 'numberfield',
name: 'afcurr',
decimalPrecision: 4,
value: 0,
listeners: {
change: function () {
if (achange) {
var afcurr = formExrateConversion.getForm().findField('afcurr').getValue();
var field = formExrateConversion.getForm().findField('bfcurr');
if (afcurr == 0) { field.setValue(0); } else {
var taxrate = (parseFloat(1).div(parseFloat(afcurr))).toFixed(4);
bchange = false;
field.setValue(taxrate);
}
}
bchange = true;
}
}
}, {
xtype: 'label',
width: 120,
text: bfcurr,
name: 'afcurr2'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
winExrateShow = Ext.create('Ext.window.Window', {
title: "币别汇率折算",
width: 450,
iconCls: "addicon",
resizable: false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [formExrateConversion],
buttons: [{
text: "确定",
minWidth: 70,
handler: function () {
var form = formExrateConversion.getForm();
var UsdExrate = form.findField('bfcurr').getValue();
if (UsdExrate == '' || UsdExrate == null || UsdExrate == undefined) {
Ext.Msg.show({ title: '提示', msg: '必须填折算汇率!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr);
if (recs.getCount() > 0) {
for (var i = 0; i < me.storeCurrExrate.getCount(); i += 1) {
var member = me.storeCurrExrate.getAt(i);
if (member.data.CURR == bfcurr) {
member.set('EXRATE', UsdExrate);
member.commit();
}
}
} else {
me.storeCurrExrate.add({ "CURR": bfcurr, "EXRATE": UsdExrate })
}
winExrateShow.close();
if (fntype == 'detail') {
me.addDetail();
}
if (fntype == 'bill') {
me.addBill();
}
return;
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
winExrateShow.close();
return;
}
}]
});
if (bfcurr == 'RMB') {
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', afcurr);
if (FFrecords.getCount() > 0) {
var ffdata = FFrecords.getAt(0).data;
var DEFRATE = ffdata.DEFRATE;
} else {
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', afcurr);
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
var DEFRATE = dfdata.DEFRATE;
} else {
var DEFRATE = 1;
}
}
var field = formExrateConversion.getForm().findField('afcurr');
achange = true;
field.setValue(DEFRATE);
} else {
var field = formExrateConversion.getForm().findField('bfcurr');
var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr);
if (recs.getCount() > 0) {
var dfdata = recs.getAt(0).data;
var DEFRATE = dfdata.DFEXRATE;
} else var DEFRATE = dfexrate;
bchange = true;
field.setValue(DEFRATE);
}
winExrateShow.show();
},
// #region 根据权限和状态判断是否允许修改
GetEditStatus: function () {
var canedit = true;
//var btnESubmitAudit = Ext.getCmp('btnSubmitAudit');
//var btnESubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
//var bsStatus = this.formEdit.getForm().findField('BSSTATUS').getValue();
//var op = this.formEdit.getForm().findField('OP').getValue();
_this = this;
_this.setSaveBtnStatus(canedit);
/*
this.StoreOpRange.load({ params: { optype: "modImportSales" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
canedit = true;
if (bsStatus == 1||bsStatus == 6)
btnESubmitAudit.enable();
else
btnESubmitAudit.disable();
if (bsStatus == 2)
btnESubmitAuditBack.enable();
else
btnESubmitAuditBack.disable();
} else {
canedit = false;
btnESubmitAudit.disable();
btnESubmitAuditBack.disable();
}
if ((bsStatus != 1) && (bsStatus != 6)) {
_this.setSaveBtnStatus(false);
} else {
_this.setSaveBtnStatus(canedit);
}
}
}
}
});
*/
},
setSaveBtnStatus: function (enable) {
var BSSTATUS = Ext.getCmp('BSSTATUS').getValue();
var btnSubmit = Ext.getCmp('btnSubmit');
var btnUnSubmit = Ext.getCmp('btnUnSubmit');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnESave = Ext.getCmp('btnESave');
var btnaddbill = Ext.getCmp('btnaddbill');
var btndeldetail = Ext.getCmp('btndeldetail');
if (BSSTATUS == "0" || BSSTATUS == "6") {
btnSubmit.enable();
btnUnSubmit.disable();
btnESave.enable();
btnaddbill.enable();
btndeldetail.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
} else if (BSSTATUS == "2") {
btnSubmit.disable();
btnUnSubmit.enable();
btnESave.disable();
btnaddbill.disable();
btndeldetail.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
} else if (BSSTATUS == "1") {
btnSubmit.disable();
btnUnSubmit.disable();
btnESave.disable();
btnaddbill.disable();
btndeldetail.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
}
},
// #endregion
//合计选中的费用数字和
onSelectFee: function (button, event) {
//Ext.getCmp("zongshu").setText("1234");
var selectedRecords = this.gridListChFee.selModel.getSelection();
var sum = 0;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
sum = sum + rec.get("Amount");
}
sum = sum.toFixed(2);
Ext.getCmp("zongshu").setText(" 选中金额:" + sum);
var selectedRecords_YF = this.gridListChFee_YF.selModel.getSelection();
var sum_YF = 0;
for (var i = 0; i < selectedRecords_YF.length; i++) {
var rec = selectedRecords_YF[i];
sum_YF = sum_YF + rec.get("Amount");
}
sum_YF = sum_YF.toFixed(2);
Ext.getCmp("zongshu_YF").setText(" 选中金额:" + sum_YF);
},
Print: function () {
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i).data;
weight = member.WEIGHT;
weight_stock = Mul(member.GOODSSTOCK, 1000);
if (weight > weight_stock) {
alert("出库重量大于剩余库存,请注意核对数据!");
//return;
}
}
var basicForm = this.formEdit.getForm();
var billNo = basicForm.findField('DELIVERYNO').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var madedate = GetDateStr(0);
var CUSTOMERNAME = basicForm.findField('CUSTOMERNAME').value;
var printType = 'Import_Delivery_1';
var sql1 = " select d.deliveryno 出库单号,d.SALESNO 销售单号, d.customername 客户名称,d.DELIVERYDATE 出库日期,d.TRUCKNO 车号";
sql1 = sql1 + " ,d.TEL 联系电话,d.REMARK 备注,ss.SALER 销售员 ";
sql1 = sql1 + " ,d.SFCM 是否抄码,d.SFKC 是否控车,(select top 1 storagename from wms where ASSOCIATEDNO in(select BSNO from import_saledetail where SALESNO=ss.SALESNO)) 库房";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=42 and EnumValueID=d.DeliveryType) 出库类型";
sql1 = sql1 + " ,d.OP 出库单操作人,(select top 1 OFFICEPHONE from user_baseinfo where userid in(select gid from [user] where showname=d.op)) 出库单操作人电话,d.contact 出库联系人";
sql1 = sql1 + " from Import_Delivery d left join import_sales ss on d.salesno=ss.salesno WHERE DELIVERYNO='" + billNo + "'";
var sql2 = " select D.GID,D.DELIVERYNO,D.SALEDETAIL_GID ,D.WEIGHT,D.BOXCOUNT,D.WEIGHT_EX 计划出库重量,D.BOXCOUNT_EX 计划出库件数,s.salesno ";
sql2 = sql2 + " ,s.weight WEIGHT_SALE,s.boxcount BOXCOUNT_SALE ,c.name 货物名称,c.factoryno 厂号,m.hth 合同号,m.Supplier_Billno 供应商合同号,M.containerNo 箱号 ";
sql2 = sql2 + " ,(select sum(weight) from import_deliverydetail where saledetail_gid=D.SALEDETAIL_GID) WEIGHT_DE ";
sql2 = sql2 + " ,(select sum(boxcount) from import_deliverydetail where saledetail_gid=D.SALEDETAIL_GID) boxcount_DE ";
sql2 = sql2 + " ,c.gid CARGO_GID,SS.CUSTOMERNAME ,D.REMARK ";
sql2 = sql2 + " ,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) 国家 ";
sql2 = sql2 + " ,c.factoryno 厂号 ,c.SPECIFICATIONS 商品规格";
sql2 = sql2 + " from Import_DeliveryDetail D ";
sql2 = sql2 + " left join import_saledetail s on s.gid=d.SALEDETAIL_GID ";
sql2 = sql2 + " left join import_cargo c on c.gid=s.cargo_gid ";
sql2 = sql2 + " left join import_main m on c.contractno=m.contractno ";
sql2 = sql2 + " left join Import_sales ss on ss.salesno=s.salesno ";
sql2 = sql2 + " where D.DELIVERYNO='" + billNo + "'";
// var sql3 = " select * from company where gid=(select top 1 companyid from ch_fee_do where BILLNO='" + billNo + "') ";
var sql3 = " select enname 公司英文名称,ENADDRESS 公司英文地址,ORGANIZATIONCODE 组织机构代码 ";
sql3 = sql3 + " ,* from company where gid='" + COMPANYID + "' ";
var sql4 = "select '" + madedate + "' as madedate,'" + CUSTOMERNAME + "' as CUSTOMERNAME,'" + SHOWNAME + "' as SHOWNAME";
var sql5 = "select * from [USER] where gid='" + USERID + "'";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
DetailAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (COMPANYID == "" || USERID == "") {
alert("登录信息不全,请退出重新登录");
returen;
}
if (e.field == 'WEIGHT' || e.field == 'PRICE' || e.field == 'EXCHANGERATE') {
var WEIGHT = parseFloat(e.record.data['WEIGHT']);
var PRICE = parseFloat(e.record.data['PRICE']);
var EXCHANGERATE = parseFloat(e.record.data['EXCHANGERATE']);
var AMOUNT = Mul(WEIGHT, PRICE, 2);
var AMOUNTRMB = Mul(AMOUNT, EXCHANGERATE, 2)
e.record.set('AMOUNT', AMOUNT);
e.record.set('AMOUNTRMB', AMOUNTRMB);
}
var AMOUNT_ALL = 0;
var AMOUNTRMB_ALL = 0;
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
AMOUNT_ALL = Add(AMOUNT_ALL, parseFloat(this.storeBodyList.getAt(i).get("AMOUNT")));
AMOUNTRMB_ALL = Add(AMOUNTRMB_ALL, parseFloat(this.storeBodyList.getAt(i).get("AMOUNTRMB")));
}
//Ext.getCmp("AMOUNT").setValue(AMOUNT_ALL);
//Ext.getCmp("AMOUNTRMB").setValue(AMOUNTRMB_ALL);
},
getCustName: function () {
var custName = this.formEdit.getForm().findField('CUSTOMERNAME');
return custName.getValue();
},
onAddFeeClick: function (BSNO) {
/* var formEdit=this.formEdit.getForm();
var BSNO = formEdit.findField('SALESNO').getValue();
var price = "0";
var Quantity = "1";
var Currency ="RMB";
var Exchangerate = "1.00";
var Remark = "";
this.addChFee(1,"",BSNO,BSNO,Currency,Exchangerate,"",price,Quantity,Remark,"","");*/
var formEdit = this.formEdit.getForm();
var SALESNO = formEdit.findField('SALESNO').getValue();
store = this.storeBodyChFee;
var record = null;
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
var EnterDate = GetDateStr(0);
record = Ext.create('MsChFee_Sales', {
GId: NewGuid(),
BsNo: '',
FeeStatus: 1,
FeeStatus_Ref: '录入状态',
FeeType: 1,
FeeType_Ref: '应收',
FeeName: '',
FeeName_Ref: '',
FeeDescription: '',
CustomerType: '',
CustomerName: this.getCustName(),
CustomerName_Ref: '',
Unit: '',
UnitPrice: 0,
Quantity: 1,
Amount: 0,
Currency: 'RMB',
ExChangerate: 1,
Reason: '',
Remark: '',
Commissionrate: 0,
Settlement: 0,
Invoice: 0,
OrderAmount: 0,
OrderInvoice: 0,
SubmitDate: null,
Auditoperator: '',
AuditDate: null,
EnteroPerator: USERID,
EnterDate: EnterDate,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
IsAdvancedpay: "0",
Sort: "0",
IsInvoice: "0",
FeeFrt: 'pp',
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
WmsOutBsNo: '',
SALESNO: SALESNO
});
store.add(record);
var editColumnIndex = 0;
var cellediting = null;
cellediting = this.cellEditingChFee;
editColumnIndex = 2;
var n = store.getCount();
cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex });
},
onDelFeeClick: function (button, event, type) {
var selectedRecords = [];
selectedRecords = this.gridListChFee.selModel.getSelection();
var candelete = DsTruck.CheckChFeeDelete_Sales(selectedRecords, this.storeOpCode2);
if (candelete == false)
return;
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.BillNo != "" || rec.BillNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.feeBodyDel.push(rec);
}
this.storeBodyChFee.remove(selectedRecords[i]);
}
}
},
//根据选定业务 生成应收费用
MakeFee: function (button, event) {
var MainList = "";
var GID = "";
selectedRecords = this.gridList.selModel.getSelection();
var formEdit = this.formEdit.getForm();
var SALESNO = formEdit.findField('SALESNO').getValue();
var DELIVERYNO = formEdit.findField('DELIVERYNO').getValue();
var _CustomerName = formEdit.findField('CUSTOMERNAME').getValue();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
/*var BSNO = rec.get('BSNO');
var price = rec.get('PRICE');
var Quantity = rec.get('WEIGHT');
var Currency = rec.get('CURRENCY');
var Exchangerate = rec.get('EXCHANGERATE');
var Remark = "销售单"+SALESNO+" "+rec.get('HTH')+"_"+rec.get('NAME');*/
var Quantity = rec.get('WEIGHT');
var SaleDetail_GID = rec.get('SALEDETAIL_GID');
this.addChFee(1, _CustomerName, SALESNO, DELIVERYNO, "购货款", SaleDetail_GID, Quantity, "");
}
},
MakeFees: function (button, event) {
var MainList = "";
var GID = "";
selectedRecords = this.gridList.selModel.getSelection();
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
//alert(member.data.SALESTATUS);
//if (member.data.MAINSTATE=="1"){
bodydatas.push(member);
//}
}
var formEdit = this.formEdit.getForm();
var SALESNO = formEdit.findField('SALESNO').getValue();
//var DELIVERYNO=formEdit.findField('DELIVERYNO').getValue();
var _CustomerName = formEdit.findField('CUSTOMERNAME').getValue();
for (var i = 0; i < bodydatas.length; i++) {
var rec = bodydatas[i];
var Quantity = rec.get('WEIGHT');
var SaleDetail_GID = rec.get('SALEDETAIL_GID');
this.addChFee(1, _CustomerName, SALESNO, rec.get('GID'), "购货款", SaleDetail_GID, Quantity, "");
}
},
//生成应收费用。
addChFee: function (FeeType, _CustomerName, SALESNO, DELIVERYNO, FeeName, SaleDetail_GID, Quantity, feedate) {
var _Amount = 0;
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
var EnterDate = GetDateStr(0);
if (feedate == "" || typeof (feedate) == "undefined") {
EnterDate = GetDateStr(0);
} else {
EnterDate = feedate;
}
//var ContractNo = Ext.getCmp("ContractNo").getValue();
var field = " (GId,BsNo,FeeStatus,FeeType,FeeName,FeeDescription,CustomerType,CustomerName,Unit,UnitPrice,TaxUnitPrice,Quantity ";
field = field + " ,Amount,NoTaxAmount,Currency,ExChangerate,Reason,Remark,Commissionrate,Settlement,Invoice,OrderAmount,OrderInvoice ";
field = field + " ,Auditoperator,EnterOperator,EnterDate,DebitNo,IsDebit,IsOpen,IsAdvancedpay,IsInvoice,FeeFrt,IsCrmOrderFee,AuditStatus,SALESNO,DELIVERYNO) ";
var _value = " select '" + NewGuid() + "',BSNO,0," + FeeType + ",'" + FeeName + "','','','" + _CustomerName + "','',PRICERMB,PRICERMB," + Quantity + "";
_value = _value + ",PRICERMB*" + Quantity + ",PRICERMB*" + Quantity + ",'RMB',1,'' ";
_value = _value + ",case CURRENCY when 'RMB' then '' else convert(varchar(50),Amount)+CURRENCY+' 汇率'+convert(varchar(50),Exchangerate) end,0,0,0,0,0 ";
_value = _value + ",'','" + USERID + "','" + EnterDate + "','',0,0,0,0,'PP',0,0,'" + SALESNO + "','" + DELIVERYNO + "' ";
_value = _value + " from Import_Saledetail where gid= '" + SaleDetail_GID + "' ";
var SQL = " Insert into ch_fee " + field + _value;
SQL = SQL + " delete from ch_fee where SALESNO= '" + SALESNO + "' and amount=0 ";
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
async: false,
waitMsg: '正在保存数据...',
url: '/Import/ImportSync/SaveSync',
scope: this,
params: {
SQL: SQL
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
//刷新费用列表
this.storeBodyChFee.load({ params: { DELIVERYNO: DELIVERYNO} });
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
}
,
/*
onSubmitAuditClick: function (button, event, type) {
if (type == '1') {
var records = this.feeGridCheckBoxModel.selected.items;
DsTruck.MsChFeeAudit(records, 2, '正在提交审核数据, 请稍侯..', USERID, "False");
} else if (type == '2') {
var selectedRecords = this.gridListChFee_YF.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if ((rec.get('FeeName') == "预付款" || rec.get('FeeName') == "购货款" || rec.get('FeeName') == "尾款") && (rec.get('Currency') == "RMB")) {
if (!confirm("货款类费用币别为RMB确认吗")) {
//点击取消
return false;
}
}
}
var records = this.feeGridCheckBoxModel_YF.selected.items;
DsTruck.MsChFeeAudit(records, 2, '正在提交审核数据, 请稍侯..', USERID, "False");
}
},*/
onSubmitAuditClick: function (button, event, type) {
var records = this.feeGridCheckBoxModel.selected.items;
if (records.length > 0) {
DsTruck.MsChFeeAudit(records, 2, '正在提交审核数据, 请稍侯..', USERID, "False");
}
},
onRetractClick: function (button, event, type) {
var records = [];
var selectedRecords = this.feeGridCheckBoxModel.selected.items;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.get('FeeStatus') == "2" || rec.get('FeeStatus') == "0") {
records.push(rec);
}
}
if (records.length > 0) {
DsTruck.MsChFeeAudit(records, 6, '正在提交审核数据, 请稍侯..', USERID, "True");
}
},
DelFee: function (DELIVERYNO) {
//将该提货单下的审核通过状态的费用全部删除//除非gid包含在ch_fee_do中
var SQL = " delete from ch_fee where DELIVERYNO in(select gid from import_deliverydetail where DELIVERYNO='" + DELIVERYNO + "')";
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
async: false,
waitMsg: '正在保存数据...',
url: '/Import/ImportSync/SaveSync',
scope: this,
params: {
SQL: SQL
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
//刷新费用列表
this.storeBodyChFee.load({ params: { DELIVERYNO: DELIVERYNO} });
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
},
gridListChFeeAfterEdit: function (editor, e, eOpts) {
if (e.field == 'FeeType') {
var records = DsStoreQueryBy(this.storeFeeTypeRef, 'EnumValueId', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('FeeType_Ref', data.EnumValueName);
} else {
e.record.set('FeeType_Ref', '');
}
}
if (e.field == 'UnitPrice' || e.field == 'Quantity' || e.field == 'ExChangerate') {
var unitPrice = e.record.data['UnitPrice'];
var quantity = e.record.data['Quantity'];
//var ExChangerate= e.record.data['ExChangerate'];
e.record.set('Amount', (unitPrice * quantity).toFixed(2));
}
},
SaveFee: function (type) {
//费用
var bodyChFeeDatas = [];
for (i = 0; i < this.storeBodyChFee.getCount(); i += 1) {
var memberyf = this.storeBodyChFee.getAt(i);
bodyChFeeDatas.push(memberyf);
var amount = memberyf.data.Amount;
if (amount == 0) {
Ext.Msg.show({ title: '警告',
msg: '费用的金额不允许为0请修改后再保存',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
};
var jsonChFeeBody = ConvertRecordsToJson(bodyChFeeDatas);
var jsonChFeeDelBody = ConvertRecordsToJsonAll(this.feeBodyDel);
if (jsonChFeeDelBody == "" && jsonChFeeBody == "") {
return;
}
var formEdit = this.formEdit.getForm();
var SALESNO = formEdit.findField('SALESNO').getValue();
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ImportSales/SaveFee',
scope: this,
params: {
SALESNO: SALESNO
, chfeebody: jsonChFeeBody
, chfeedelbody: jsonChFeeDelBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//alert("保存成功");
var returnData = jsonresult.Data;
this.feeBodyDel = [];
this.storeBodyChFee.commitChanges();
} 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
});
}
//alert('03');
}
});
}
,
LockClick: function () {
var formEdit = this.formEdit.getForm();
var DELIVERYNO = formEdit.findField('DELIVERYNO').getValue();
//生成费用
//this.MakeFees();
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ImportDelivery/LockDelivery',
scope: this,
params: {
DELIVERYNO: DELIVERYNO
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.getCmp("BSSTATUS").setValue("1");
this.setSaveBtnStatus();
if (this.opStatus == 'edit')
condition = " GID='" + this.editRecord.get('GID') + "'";
this.LoadData(this.opStatus, condition);
} 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
});
}
//alert('03');
}
});
}
,
UnLockClick: function () {
var formEdit = this.formEdit.getForm();
var DELIVERYNO = formEdit.findField('DELIVERYNO').getValue();
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ImportDelivery/UnLockDelivery',
scope: this,
params: {
DELIVERYNO: DELIVERYNO
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.getCmp("BSSTATUS").setValue("0");
_this.setSaveBtnStatus();
_this.OpStatus = 'edit';
_this.UnlockInitData(DELIVERYNO);
_this.storeBodyChFee.load({ params: { DELIVERYNO: DELIVERYNO} });
} 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
});
}
//alert('03');
}
});
}
, SaveWMSOUT: function (type) {
//逐条遍历销售信息
//根据销售信息查询WMS表获得WMS对象
//根据WMS对象的数据和销售信息数据生成WMSOUT和WMSOUTDetail
//使用WMSOUT和WMSOUTDetail作参数调用/MvcShipping/WMS/SaveWMSOUT
//完成后使用WMSOUT作参数调用/MvcShipping/WMS/LockOut
var basicForm = this.formEdit.getForm();
var data = basicForm.getValues();
var DELIVERYNO = data.DELIVERYNO;
var total = this.storeBodyList.getCount(); //数据行数
for (var i = 0; i < total; i++) {
var row = this.storeBodyList.getAt(i);
var SALEDETAIL_GID = row.get('SALEDETAIL_GID');
var WEIGHT = row.get('WEIGHT');
var BOXCOUNT = row.get('BOXCOUNT');
if (parseFloat(WEIGHT) == 0 || parseFloat(BOXCOUNT) == 0) {
alert("实际出库重量或件数均不允许锁定为0");
return;
}
var WMS = null;
var _s = " Cargo_gid=(select CARGO_GID from Import_Saledetail where gid='" + SALEDETAIL_GID + "') and CUSTOMERNAME='" + data.CUSTOMERNAME + "' ";
Ext.Ajax.request({
async: false,
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/WMS/GetData',
params: {
handle: 'edit',
condition: _s
},
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;
}
//////////////////////////////////////////////////////////
WMS = result.data;
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
var _e = Ext.util.Format.date(WMS.WMSDATE, 'Y-m-d'); //格式化日期控件值
var _s = Ext.util.Format.date(data.DELIVERYDATE, 'Y-m-d'); //格式化日期控件值
var end = new Date(_e);
var start = new Date(_s);
var FEEDAYS = Math.round((end.getTime() - start.getTime()) / (86400000)) + 1; // 计算间隔日数
if ((this.formEdit.getForm().findField('SFCM').getValue() ? 1 : 0) == 1) {
//抄码的不限制重量
} else {
//不抄码的限制库存
if (Mul(WMS.GOODSSTOCK, 1000, 2) < Cut(row.get('WEIGHT'), 1, 2)) {//允许1公斤以内的误差
alert(WMS.GOODSNAME + " 的本次出库重量超出目前库存重量,请检查 " + WMS.CONTRACTNO + " 的库存情况");
return false;
}
}
}
//如果以前都无问题 才真的进行锁定
//20170204 出库单改为只生成一条 明细均位于其下。
//#region 根据WMS对象的数据和销售信息数据生成WMSOUT和WMSOUTDetail
var WMSOUT = "";
var WMSOUTDetaildatas = [];
for (var i = 0; i < total; i++) {
var row = this.storeBodyList.getAt(i);
var SALEDETAIL_GID = row.get('SALEDETAIL_GID');
var DD_GID = row.get('GID');
var WEIGHT = row.get('WEIGHT');
var BOXCOUNT = row.get('BOXCOUNT');
if (parseFloat(WEIGHT) == 0 || parseFloat(BOXCOUNT) == 0) {
alert("实际出库重量或件数均不允许锁定为0");
return;
}
var WMS = null;
var _s = " Cargo_gid=(select CARGO_GID from Import_Saledetail where gid='" + SALEDETAIL_GID + "') ";
Ext.Ajax.request({
async: false,
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/WMS/GetData_Import',
params: {
handle: 'edit',
condition: _s
},
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;
}
//////////////////////////////////////////////////////////
WMS = result.data;
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
var _e = Ext.util.Format.date(WMS.WMSDATE, 'Y-m-d'); //格式化日期控件值
var _s = Ext.util.Format.date(data.DELIVERYDATE, 'Y-m-d'); //格式化日期控件值
var end = new Date(_e);
var start = new Date(_s);
var FEEDAYS = Math.round((end.getTime() - start.getTime()) / (86400000)) + 1; // 计算间隔日数
if (WMSOUT == "") {
WMSOUT = Ext.create('WMSOUTmb', {
GID: NewGuid(),
ASSOCIATEDNO: WMS.ASSOCIATEDNO,
BSNO: DELIVERYNO,
CLIENTGID: WMS.CLIENTGID,
CLIENTCODE: WMS.CLIENTCODE,
CUSTOMERNAME: data.CUSTOMERNAME,
DODATE: data.DELIVERYDATE,
STORAGECODE: "",
STORAGENAME: WMS.STORAGENAME,
AREACODE: "",
AREANAME: "",
GOODSCODE: "",
GOODSNAME: WMS.GOODSNAME,
GOODSTYPE: "",
GOODSMODEL: WMS.GOODSMODEL,
GOODSSTANDARD: "",
GOODSPACK: "",
CHARGEUNIT: "吨",
GOODSPFSL: Div(row.get('WEIGHT'), 1000, 6), //出库重量
GOODSOUTFEE: "0",
GOODSOUTFEEAP: "0",
TRUCKNO: data.TRUCKNO,
REMARK: "",
ISDELETE: "",
DELETETIME: "",
DELETEUSER: "",
CREATEUSER: USERID,
CREATETIME: "",
MODIFIEDUSER: "",
MODIFIEDTIME: "",
GOODSPACKPFSL: row.get('BOXCOUNT'), /////////////出库件数
TRUCKNAME: "",
WMSOP: "",
STOREMAN: "",
ISLOCK: "",
LOCKTIME: "",
LOCKUSER: "",
ARFEE: "0",
APFEE: "0",
INSPECTIONNO: "",
CUSTOMNO: "",
CORPID: COMPANYID,
CLIENTNAMEOLD: "",
OLDCUSTFEEDATE: row.get('DELIVERYDATE'), //', type : 'date' },
CLIENTBSNO: "",
ARCLIENT: "",
INGIDNEW: "",
VALIDDATE: "", //', type : 'date' },
TOTALNO: "",
REMARK2: "",
MBLNONEW: "",
ISCHANGE: "",
ARCLIENTWMSOUT: data.CUSTOMERNAME,
BZTCHNO: "",
ISCOLLECTING: "",
MBLNO: "" //', type : 'string' }
});
} else {
WMSOUT.data.GOODSPFSL = Add(WMSOUT.data.GOODSPFSL, Div(row.get('WEIGHT'), 1000, 6));
WMSOUT.data.GOODSPACKPFSL = Add(WMSOUT.data.GOODSPACKPFSL, row.get('BOXCOUNT'));
WMSOUT.data.REMARK = WMSOUT.data.REMARK + WMS.GOODSNAME + ";";
}
var WMSOUTDetail = Ext.create('WMSOUTDetailmb', {
GID: NewGuid(),
INBSNO: WMS.GID,
OUTBSNO: "", //DELIVERYNO,
BLNO: "",
CONTRACTNO: WMS.CONTRACTNO,
CNTRNO: "",
SEALNO: "",
BSNO: DD_GID, //20170106 将wms_out_detail里目前无用的BSNO 填入出库单明细import_deliverydetail的GID 用于通过它和它的saledetail_gid关联出库明细和销售明细
CLIENTGID: "",
CLIENTCODE: "",
CUSTOMERNAME: data.CUSTOMERNAME,
DODATE: currdate.format('yyyy-MM-dd hh:mm:ss'),
STORAGECODE: "",
STORAGENAME: WMS.STORAGENAME,
AREACODE: "",
AREANAME: "",
GOODSCODE: "",
GOODSNAME: WMS.GOODSNAME,
GOODSTYPE: "1",
GOODSMODEL: WMS.GOODSMODEL,
GOODSSTANDARD: "",
GOODSPACK: "0",
CHARGEUNIT: "吨",
GOODSPFSL: Div(row.get('WEIGHT'), 1000, 6),
GOODSPACKPFSL: row.get('BOXCOUNT'),
GOODSOUTFEE: "0",
GOODSOUTFEEAP: "0",
TRUCKNO: data.TRUCKNO,
REMARK: "",
CREATEUSER: USERID,
CREATETIME: currdate.format('yyyy-MM-dd hh:mm:ss'),
ASSOCIATEDNO: WMS.ASSOCIATEDNO,
ARFEE: "0",
APFEE: "0",
ISLOCK: "0",
LOCKTIME: "",
LOCKUSER: "",
CORPID: COMPANYID,
CLIENTNAMEOLD: "",
OLDCUSTFEEDATE: data.DELIVERYDATE,
STARTBILLINGDATE: WMS.WMSDATE,
ENDBILLINGDATE: data.DELIVERYDATE,
FEEDAYS: FEEDAYS,
GOODSSLICE: "0",
GOODSGRADE: "",
STARTBILLINGDATEAP: WMS.WMSDATE,
ENDBILLINGDATEAP: data.DELIVERYDATE,
FEEDAYSAP: FEEDAYS,
ISCHANGE: "",
MARKETVALUE: "0",
BZTCHNO: "",
i_WMSDATE: "",
i_CUSTOMERNAME: "",
i_GOODSNAME: "",
i_GOODSMODEL: "",
i_GOODSPACKSTOCK: "",
i_GOODSSTOCK: "",
i_BLNO: "",
i_STARTBILLINGDATE: "",
i_STARTBILLINGDATEAP: "",
i_MARKETVALUE: "",
i_BANKVALUE: "",
i_ISDELETE: "",
i_INBSNO: ""
});
//#endregion
WMSOUTDetaildatas.push(WMSOUTDetail)
}
//#region 使用WMSOUT和WMSOUTDetail作参数调用/MvcShipping/WMS/SaveWMSOUT
//WMSOUTDetaildatas.push(WMSOUTDetail);
var WMSOUTDetailBody = ConvertRecordsToJsonAll(WMSOUTDetaildatas);
var WMSOUTDetailBodyDel = ConvertRecordsToJson("");
var _this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/WMS/SaveWMSOUT',
scope: this,
async: false,
params: {
OpStatus: 'add',
data: Ext.JSON.encode(WMSOUT.data),
WMSOUTDetailBody: WMSOUTDetailBody,
WMSOUTDetailBodyDel: WMSOUTDetailBodyDel
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
////锁定出库业务
} 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
});
}
//alert('03');
}
});
//#endregion
//_this.LockClick();
},
DelWMSOUT: function (type) {
var basicForm = this.formEdit.getForm();
var data = basicForm.getValues();
var DELIVERYNO = data.DELIVERYNO;
var _this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/WMS/DeleteOUTByBSNO',
scope: this,
async: false,
params: {
BSNO: DELIVERYNO
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
_this.DelFee(DELIVERYNO);
if (response.responseText != "") {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//var returnData = jsonresult.Data;
} 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
});
}
//alert('03');
}
});
},
LoadAccBodyList: function (button, event) {
var custome = _this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
var billno = _this.formEdit.getForm().findField('DELIVERYNO').getValue();
var curr = "RMB";
var sql = "CUSTOMERNAME='" + custome + "' and (ISFINISH=0 or ISFINISH IS NULL) AND FEETYPE=1 AND currency='" + curr + "' AND BILLNO<>'" + billno + "'";
this.storeAccBodyList.load({ params: { start: 0, limit: 9999, sort: '', condition: sql} });
},
onAddAPDetailClick: function (button, event) {
var gid = this.formEdit.getForm().findField('GID').getValue();
var billno = this.formEdit.getForm().findField('DELIVERYNO').getValue();
var basicForm = this.formEdit.getForm();
var selectedRecords = this.gridListAcc.selModel.getSelection();
var bodyAddDatas = [];
_this = this;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
bodyAddDatas.push(rec);
}
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要添加的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Account/Chfee_Foreignsettlement/AddAPDetail',
scope: this,
params: {
billno: billno,
data: jsonbodyAddDatas,
stlnogid: gid,
feetype: 2
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.LoadAccBodyList();
_this.storeBodyListAcc.load({ params: { condition: " SETTLEBILLNO='" + billno + "'" },
callback: function (r, options, success) {
if (success) {
if (_this.storeBodyListAcc.getCount() > 0) (this.comboxCurrADVANCE.readOnly = true)
}
},
scope: this
});
} 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
});
}
}
});
},
onDeleteApClick: function (button, event) {
var billno = this.formEdit.getForm().findField('DELIVERYNO').getValue();
var selectedRecords = this.gridBodyListAcc.selModel.getSelection();
var bodyAddDatas = [];
_this = this;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
var voucherno = rec.data.VOUCHERNO;
if (voucherno == '') {
bodyAddDatas.push(rec);
} else {
Ext.Msg.show({ title: '提示', msg: '已生成凭证不能删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要删除明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Account/Chfee_Foreignsettlement/DelAPBill',
scope: this,
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
/* var custome = _this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
var billno = _this.formEdit.getForm().findField('DELIVERYNO').getValue();
var curr = "RMB";
var sql = "CUSTOMERNAME='" + custome + "' and (ISFINISH=0 or ISFINISH IS NULL) AND FEETYPE=1 AND currency='" + curr + "' AND BILLNO<>'" + billno + "'";
_this.storeAccBodyList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} }); */
_this.LoadAccBodyList();
_this.storeBodyListAcc.load({ params: { condition: " SETTLEBILLNO='" + billno + "'" },
callback: function (r, options, success) {
if (success) {
if (_this.storeBodyListAcc.getCount() > 0) (this.comboxCurrADVANCE.readOnly = true)
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/Chfee_Foreignsettlement/GetData',
params: {
handle: 'edit',
condition: " BILLNO='" + billno + "'"
},
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.formAHSR.getForm().reset();
_this.formADVANCE.getForm().reset();
_this.formAHSR.getForm().setValues(data);
_this.formADVANCE.getForm().setValues(data);
var editp = Ext.create('MsChSettlement', data);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
} 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
});
}
}
});
}
,
onSettlementClick: function (button, event) {
var DELIVERYNO = this.formEdit.getForm().findField('DELIVERYNO').getValue();
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ImportDelivery/SetSettlement',
scope: this,
params: {
DELIVERYNO: DELIVERYNO
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
/* var custome = _this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
var billno = _this.formEdit.getForm().findField('DELIVERYNO').getValue();
var curr = "RMB";
var sql = "CUSTOMERNAME='" + custome + "' and (ISFINISH=0 or ISFINISH IS NULL) AND FEETYPE=1 AND currency='" + curr + "' AND BILLNO<>'" + billno + "'";
_this.storeAccBodyList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} }); */
_this.LoadAccBodyList();
_this.storeBodyListAcc.load({ params: { condition: " SETTLEBILLNO='" + DELIVERYNO + "'" },
callback: function (r, options, success) {
if (success) {
if (_this.storeBodyListAcc.getCount() > 0) (this.comboxCurrADVANCE.readOnly = true)
}
},
scope: this
});
_this.storeBodyChFee.load({ params: { DELIVERYNO: DELIVERYNO} });
} 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
});
}
}
});
}
,
SubmitAudit_OUT: function (Value) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择记录!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var LockWMS = [];
//提交审核
if (Value == "2") {
Ext.MessageBox.confirm('提示', '确定要操作选中的入库信息吗?', function (btn) {
if (btn == 'yes') {
//var selectedRecords = this.WMSCB.selected.items;
//if (selectedRecords.length > 0) {
//or (var i = 0; i < selectedRecords.length; i++) {
//var rec = selectedRecords[i];
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var rec = Ext.create('WMSOUTmb');
rec.data = basicForm.getValues();
if (rec.data.ASSOCIATEDNO != "") //没有保存的数据无法锁定
{
LockWMS.push(rec);
}
//}
//}
var LockWMSJSNO = ConvertRecordsToJsonAll(LockWMS);
var _this = this;
if (Value == "2") {
Ext.Ajax.request({//
waitMsg: '正在处理数据...',
url: '/MvcShipping/WMS/SubmitAudit_OUT',
params: {
WMSList: LockWMSJSNO,
LOCK: Value
},
callback: function (options, success, response) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
alert(jsonresult.Message);
} else {
alert("操作失败" + jsonresult.Message);
}
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
scope: this
}); //request over
}
}
}, this);
}
//审核撤回
if (Value == "0") {
Ext.MessageBox.confirm('提示', '确定要操作选中的入库信息吗?', function (btn) {
if (btn == 'yes') {
var selectedRecords = this.WMSCB.selected.items;
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.ASSOCIATEDNO != "") //没有保存的数据无法锁定
{
LockWMS.push(rec);
}
}
}
var LockWMSJSNO = ConvertRecordsToJsonAll(LockWMS);
var _this = this;
Ext.Ajax.request({//
waitMsg: '正在处理数据...',
url: '/MvcShipping/WMS/CancelAudit',
params: {
WMSList: LockWMSJSNO,
LOCK: Value
},
callback: function (options, success, response) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
alert(jsonresult.Message);
} else {
alert("操作失败" + jsonresult.Message);
}
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
scope: this
}); //request over
}
}, this);
}
} //onDeleteClick
});