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

1131 lines
35 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Ext.namespace('DsTruck');
var C_feeid = "";
var C_contractno = "";//用于存储当前选定的合同号/ch_fee.id
DsTruck.CWSettlementIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.CWSettlementIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.CWSettlementIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'XXHmb',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/Import/XXH/GetDataList',
reader: {
idProperty: 'id' + 'cgid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//枚举参照
this.storeport = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeport.load({ params: { enumTypeId: 10} });
this.comboxport = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '目的港',
store: this.storeport,
name: 'port'
});
this.storeMainstate = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeMainstate.load({ params: { enumTypeId: 3} });
this.comboxMainstate = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '合同状态',
store: this.storeMainstate,
name: 'Mainstate'
});
//表参照
this.storeCountry = Ext.create('DsExt.ux.RefTableStore', {
model: 'ConutryRef',
proxy: { url: '/CommMng/BasicDataRef/GetCountryRefList' }
});
this.storeCountry.load({ params: { condition: ""} });
this.comboxCountry = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '进口国',
store: this.storeCountry,
name: 'countryid',
valueField: 'countryid',
displayField: 'country_idandname'
});
this.storeCargoinfo = Ext.create('DsExt.ux.RefTableStore', {
model: 'CargoRef',
proxy: { url: '/CommMng/BasicDataRef/GetCargoRefList' }
});
this.storeCargoinfo.load({ params: { condition: ""} });
this.comboxCargoinfo = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'HS代码',
store: this.storeCargoinfo,
name: 'Cargoinfo_id',
valueField: 'id',
displayField: 'codeandname'
//HS代码
});
this.storeCargociq = Ext.create('DsExt.ux.RefTableStore', {
model: 'CargociqRef',
proxy: { url: '/CommMng/BasicDataRef/GetCargociqRefList' }
});
this.storeCargociq.load({ params: { condition: ""} });
this.comboxCargociq = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'ciq代码',
store: this.storeCargociq,
name: 'Cargociq_id',
valueField: 'id',
displayField: 'codeandname'
//ciq代码
});
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: '用证公司',
store: this.storeCompany,
name: 'company',
valueField: 'gid',
displayField: 'name'
});
this.storeRemind = Ext.create('DsExt.ux.RefTableStore', {
model: 'remind',
proxy: { url: '/CommMng/BasicDataRef/Getimportremind' }
});
this.storeRemind.load({ params: { condition: ""} });
this.comboxRemind = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务提醒',
store: this.storeRemind,
name: 'Remind',
valueField: 'RemindSql',
displayField: 'RemindName',
triggerAction: 'all',
selectOnFocus: true,
listeners: {
change: function (field, newValue, oldValue) {
this.onGetremind(field, newValue, oldValue);
},
scope: this
}
});
/*
this.comboxRemind.on
({
"select": function (field, newValue, oldValue) {
var sqltext = newValue;
alert(sqltext);
if (sqltext == "") return;
this.storeList.load({
params: { start: 0, limit: 500, sort: '', condition: sqltext },
waitMsg: "正在查询数据...",
scope: this
});
}
});
*/
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'north',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
height: 200,
columns: [
{
sortable: true,
dataIndex: 'seller',
header: '贸易商',
width: 80
}, {
sortable: true,
dataIndex: 'buyer',
header: '购货方',
width: 80
}, {
sortable: true,
dataIndex: 'ContractNo',
header: '合同序列号',
width: 120
}, {
sortable: true,
dataIndex: 'HTH',
header: '合同号',
width: 80
}, {
sortable: true,
dataIndex: 'country',
header: '进口国',
width: 80
}, {
sortable: true,
dataIndex: 'countryid',
header: 'countryid',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'portRef',
header: '目的港',
width: 80
}, {
sortable: true,
dataIndex: 'companyname',
header: '用证公司',
width: 80
}, {
sortable: true,
dataIndex: 'name',
header: '货物名称',
width: 80
}, {
sortable: true,
dataIndex: 'MainstateRef',
header: '合同状态',
width: 80
}, {
sortable: true,
dataIndex: 'ArrivalDate',
header: '到港日',
width: 80
}, {
sortable: true,
dataIndex: 'tax_date',
header: '出税日期',
width: 80
}, {
sortable: true,
dataIndex: 'tax_paydate',
header: '付税日期',
width: 80
}, {
sortable: true, dataIndex: 'id', header: 'id', hidden: true
},
{
dataIndex: 'TimeMark', header: 'TimeMark', hidden: true
},
{
sortable: true,
dataIndex: 'cgid',
header: 'cgid',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'BillNo',
header: '提单号',
width: 80
},
{
sortable: true,
dataIndex: 'ContainerNo',
header: '箱号',
width: 80
},
{
sortable: true,
dataIndex: 'SealNo',
header: '铅封号',
width: 80
}]
});
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
this.formSearch = 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: '合同号',
name: 'ContractNo'
}, {
fieldLabel: '合同序列号',
name: 'HTH'
},
this.comboxCompany,
this.comboxCountry]
}]
}, //end items(fieldset 1)
{//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxport,
this.comboxCargoinfo,
this.comboxCargociq//, this.comboxCountry
]
}]
}, //end fieldset 2
{//fieldset 3
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxMainstate,
{
fieldLabel: '贸易商',
name: 'seller'
}, {
fieldLabel: '客户',
name: 'buyer'
}]
}]
}, //end items(fieldset 3)
{//fieldset 4
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '提单号',
name: 'BillNo'
}, {
fieldLabel: '箱号',
name: 'ContainerNo'
}, {
fieldLabel: '铅封号',
name: 'SealNo'
}]
}]
}, //end items(fieldset 4)
{//fieldset 5
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '包含双抬头',
xtype: 'checkbox',
name: 'STT'
}, this.comboxRemind, {
fieldLabel: '备注中包含',
name: 'remark'
}]
}]
} //end items(fieldset 5)
]//end root items
});
//#endregion formSearch
//费用列表
//#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,
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,
name: 'CustomerName',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//明细表 ch_fee 数据集
this.storeBodyChFee = Ext.create('Ext.data.Store', {
model: 'MsChFee',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/CW/GetAuditDataList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表 ch_fee
this.cellEditingChFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.feeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel', { checkOnly: false });
this.gridListChFee = new Ext.grid.GridPanel({
store: this.storeBodyChFee,
enableHdMenu: false,
region: 'center',
// height: '250',
// weight: '300',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingChFee],
selModel: this.feeGridCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
enableTextSelection: true
,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FeeStatus');
return DsTruck.MsChFeeGetRowClass(feeStatus);
}
},
tbar: [{
id: "btnSave",
text: '保存',
tooltip: '保存更改',
iconCls: "btnsave",
handler: function (button, event) {
this.Save();
//alert(USERID);
},
scope: this
}, '-', {
id: "btnFeeAuditPass",
text: '通过',
tooltip: '审核通过',
iconCls: "btnconfirm",
handler: function (button, event) {
this.onAuditPassClick(button, event);
},
scope: this
}, {
id: "btnFeeAuditReject",
text: '驳回',
tooltip: '驳回提交',
iconCls: "btnrefuse",
handler: function (button, event) {
this.onAuditRefuseClick(button, event);
},
scope: this
}, { xtype: "label", id: "zongshu", text: "金额",
handler: function () { ; }
}, {
id: "btnSettlementAll",
text: '结算完成',
tooltip: '选中条目全部结算',
iconCls: "btnconfirm",
handler: function (button, event) {
this.onSettlementAllClick(button, event);
},
scope: this
}, {
id: "btnSettlement",
text: '部分结算',
tooltip: '选中条目部分结算',
iconCls: "btnadd",
handler: function (button, event) {
this.onSettlementClick(button, event);
},
scope: this
}
],
columns: [{
sortable: true,
dataIndex: 'GId',
header: '惟一编号',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'BsNo',
header: '业务编号',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'FeeStatus',
header: '费用状态',
renderer: function (value, p, record) {
return record.data.FeeStatus_Ref;
},
width: 66
}, {
sortable: true,
dataIndex: 'FeeType',
header: '收付方式',
renderer: function (value, p, record) {
if (value == null || value == '')
return value;
else
return value + '-' + record.data.FeeType_Ref;
},
width: 66
}, {
sortable: true,
dataIndex: 'FeeName',
header: '费用名称',
width: 80
}, {
sortable: true,
dataIndex: 'FeeDescription',
header: '费用英文名称',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'Amount',
header: '金额',
width: 60
}, {
sortable: true,
dataIndex: 'CustomerType',
header: '客户类别',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '结算对象',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 100
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: '单价',
/* editor: {
xtype: 'numberfield',
selectOnFocus: true
},*/
width: 60,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Quantity',
header: '数量(税率)',
width: 60
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
width: 40
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: '汇率',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 60
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 150
}, {
sortable: true,
dataIndex: 'SubmitDate',
header: '提交时间',
//hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'Auditoperator',
header: '审核人',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'AuditDate',
header: '审核时间',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'EnteroPerator',
header: '录入人',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'EnterDate',
header: '录入时间',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'AuditStatus',
header: '审核状态',
hidden: true,
width: 100
}
]
});
//明细表 ch_fee over----------------------------------------------
//明细表 ch_fee_do
//明细表 ch_fee_do 数据集
this.storeChFeeDo = Ext.create('Ext.data.Store', {
model: 'ChFeeDomb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsChFee/GetChFeeDo',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表 ch_fee_do
this.CEChFeeDo = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.FeeDoCheckBoxModel = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.gridListChFeeDo = new Ext.grid.GridPanel({
store: this.storeChFeeDo,
enableHdMenu: false,
region: 'center',
height: '250',
weight: '300',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.CEChFeeDo],
selModel: this.FeeDoCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
enableTextSelection: true/*,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FeeStatus');
return DsTruck.MsChFeeGetRowClass(feeStatus);
}*/
},
tbar: [{
id: "btnAddChFeeDo",
text: '增加明细',
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.addChFeeDo(button, event);
//alert(USERID);
},
scope: this
}, '-', {
id: "btnDelChFeeDo",
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.delChFeeDo(button, event);
},
scope: this
}
],
columns: [{
sortable: true,
dataIndex: 'Gid',
header: '惟一编号',
hidden: true,
width: 160
}, {
sortable: true,
dataIndex: 'bsno',
header: '合同序列号',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'feename',
header: '费用名称',
width: 80
}, {
sortable: true,
dataIndex: 'Doamount',
header: '本次结算金额',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
},
}, {
sortable: true,
dataIndex: 'customername',
header: '结算对象',
width: 100
}, {
sortable: true,
dataIndex: 'createtime',
header: '提交时间',
//hidden: true,
width: 200
}
]
});
//--------------------------------------over
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
},
scope: this
}
]
});
//绑定事件
this.gridListChFee.on('edit', function (editor, e, eOpts) {
this.gridListChFeeAfterEdit(editor, e, eOpts);
}, this);
this.cellEditingChFee.on('beforeedit', function (editor, e) {
//Ext.getCmp("zongshu").setText("1234");
return this.cellEditingChFeeBeforeEdit(editor, e);
}, this);
this.gridListChFee.getSelectionModel().on('select', function (button, event) {
//Ext.getCmp("zongshu").setText("1234");
this.onSelectFee(button, event);
}, this);
this.gridListChFee.on('cellclick', function (button, event) {
//Ext.getCmp("zongshu").setText("1234");
this.onSelectFee(button, event);
}, this);
//选择load
this.gridList.getSelectionModel().on('select', function (model, record, index) {
this.C_contractno = record.data.ContractNo;
this.storeBodyChFee.load({ params: { billno: this.C_contractno} });
}, this);
this.gridListChFee.getSelectionModel().on('select', function (model, record, index) {
this.C_feeid = record.data.GId;
this.storeChFeeDo.load({ params: { condition: " fd.bsno='" + this.C_contractno + "' and fd.feeid='" + this.C_feeid + "'"} });
}, this);
//布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 180,
items: [this.formSearch, this.panelBtn]
});
this.panelContract = new Ext.Panel({
layout: "border",
region: "center",
height: 200,
items: [this.gridList]
});
this.panelMain = new Ext.Panel({
layout: "border",
region: "north",
height: 380,
items: [this.panelTop, this.panelContract]
}); //合同查询和结果
this.panelChFee = new Ext.Panel({
title: '审核应收',
layout: "border",
region: 'west',
width: 450,
margin: '1 2',
items: [this.gridListChFee]
});
this.panelChFeeSettlement = new Ext.Panel({
title: '实付明细',
layout: "border",
region: 'center',
margin: '1 2',
items: [this.gridListChFeeDo]
});
this.panelFee = new Ext.Panel({
layout: "border",
region: "center",
items: [
this.panelChFee, this.panelChFeeSettlement
]
});
Ext.apply(this, {
items: [this.panelMain
, this.panelFee
]
});
}, //end initUIComponents
cellEditingFixBeforeEdit: function (editor, e) {
var feeStatus = this.getFeeStatus();
var billStatus = this.getBillStatus();
var canedit = feeStatus == '0' && billStatus == '0';
return canedit;
},
cellEditingChFeeBeforeEdit: function (editor, e) {
var chfeefeeStatus = e.record.get('FeeStatus');
var canedit = chfeefeeStatus == 1 || chfeefeeStatus == 2 || chfeefeeStatus == 6;
//alert(canedit);
return canedit;
},
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);
},
gridListChFeeAfterEdit: function (editor, e, eOpts) {
if (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 * ExChangerate).toFixed(2));
}
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: 500, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDeleteClick: function (button, event) {
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 record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Import/XXH/Delete',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
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 });
}
}
},
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);
}, //onDeleteClick
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var ContractNo = form.findField('ContractNo').getValue();
sql = sql + getAndConSql(sql, ContractNo, "M.ContractNo like '%" + ContractNo + "%'");
var company = form.findField('company').getValue();
sql = sql + getAndConSql(sql, company, "M.company = '" + company + "'");
var countryid = form.findField('countryid').getValue();
sql = sql + getAndConSql(sql, countryid, "m.countryid like '%" + countryid + "%'");
var port = form.findField('port').getValue();
sql = sql + getAndConSql(sql, port, "m.port = " + port + "");
var Cargoinfo_id = form.findField('Cargoinfo_id').getValue();
//alert(Cargoinfo_id);
sql = sql + getAndConSql(sql, Cargoinfo_id, "cg.Cargoinfo_id = " + Cargoinfo_id + "");
var Cargociq_id = form.findField('Cargociq_id').getValue();
//alert(Cargociq_id);
sql = sql + getAndConSql(sql, Cargociq_id, "cg.Cargociq_id = " + Cargociq_id + "");
var Mainstate = form.findField('Mainstate').getValue();
sql = sql + getAndConSql(sql, Mainstate, "m.Mainstate = " + Mainstate + "");
var seller = form.findField('seller').getRawValue();
sql = sql + getAndConSql(sql, seller, "M.seller like '%" + seller + "%'");
var buyer = form.findField('buyer').getRawValue();
sql = sql + getAndConSql(sql, buyer, "M.buyer like '%" + buyer + "%'");
var BillNo = form.findField('BillNo').getRawValue();
sql = sql + getAndConSql(sql, BillNo, "m.BillNo like '%" + BillNo + "%'");
var ContainerNo = form.findField('ContainerNo').getRawValue();
sql = sql + getAndConSql(sql, ContainerNo, "m.ContainerNo like '%" + ContainerNo + "%'");
var SealNo = form.findField('SealNo').getValue();
sql = sql + getAndConSql(sql, SealNo, "m.SealNo like '%" + SealNo + "%'");
// alert(sql);
var STT = form.findField("STT").getValue();
if (STT)
{ sql = sql + getAndConSql(sql, STT, " m.STT is not null and m.STT<>'' "); }
var remark = form.findField('remark').getValue();
sql = sql + getAndConSql(sql, remark, "m.remark like '%" + remark + "%'");
var Remind = form.findField('Remind').getValue();
sql = sql + getAndConSql(sql, Remind, Remind);
return sql;
},
onGetremind: function (field, newValue, oldValue) {
if (newValue != null) {
this.storeList.load({
params: { start: 0, limit: 500, sort: '', condition: newValue },
waitMsg: "正在查询数据...",
scope: this
});
}
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
// alert(this.OprationStatus.ToString());
// alert(this.storeList.toString());
// alert(this.SelectedRecord.toString());
onAuditPassClick: function (button, event) {
var records = this.feeGridCheckBoxModel.selected.items;
DsTruck.MsChFeeAudit(records, 0, '正在审核数据, 请稍侯..');
}, //通过
onAuditRefuseClick: function (button, event) {
var records = this.feeGridCheckBoxModel.selected.items;
DsTruck.MsChFeeAudit(records, 6, '正在审核数据, 请稍侯..');
}, //驳回提交
onSettlementClick: function (button, event) {
var records = this.feeGridCheckBoxModel.selected.items;
DsTruck.MsChFeeAudit(records, 8, '正在审核数据, 请稍侯..');
}, //部分结算
onSettlementAllClick: function (button, event) {
var records = this.feeGridCheckBoxModel.selected.items;
DsTruck.MsChFeeAudit(records, 9, '正在审核数据, 请稍侯..');
}, //全部结算
Save: 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);
if (jsonChFeeBody == "") {
return;
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/CWAudit/Save',
scope: this,
params: {
chfeebody: jsonChFeeBody
},
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.storeBodyChFee.getForm().setValues(returnData);
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');
}
});
}
});