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/PortOperate/HistryFeeIndex.js

1546 lines
51 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.XXHHistryFee = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.XXHHistryFee.superclass.constructor.call(this);
};
Ext.extend(Shipping.XXHHistryFee, Ext.Panel, {
PageSize: 10,
ParentWin: null,
feeType: 0,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
StoreFee: null,
StoreFeeUnit: null,
StoreFeeCust: null,
EditRecord: null,
StoreDateCurr: null,
StoreCurr: null,
storeCustomerNameRef: null,
initUIComponents: function () {
this.sqlcontext = '';
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'XXH_ALL_singlemb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/XXH/GetDataList_ALL_single',
reader: {
id: 'HTH',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region 主grid
this.gridListCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'north',
height: 268,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.gridListCheckBoxModel,
viewConfig: {
autoFill: true,
enableTextSelection: true
},
columns: [
{
sortable: true,
dataIndex: 'seller',
header: '贸易商',
width: 80, editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'buyer',
header: '购货方',
width: 80
}, {
sortable: true,
dataIndex: 'HTH',
header: '合同号',
width: 80
}, {
sortable: true,
dataIndex: 'country',
header: '进口国',
width: 80
}, {
sortable: true,
dataIndex: 'AuditorREF',
header: '审单人',
width: 80
}, {
sortable: true, //5
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: 'CORPNAME',
header: '当前货所属公司',
width: 100
}, {
xtype: 'numbercolumn',
sortable: true,
dataIndex: 'tax_amount_RMB',
header: '完税价格(RMB)',
format: '0.00',
width: 80
},{
sortable: true,
dataIndex: 'creattime',
header: '接单日期',
width: 80
}, {
sortable: true,
dataIndex: 'name',
header: '货物名称',
width: 80
}, {
sortable: true, //10
dataIndex: 'weight_t',
header: '净重(吨)',
width: 80
}, {
sortable: true, //10
dataIndex: 'weight',
header: '净重(kg)',
width: 80
}, /*{
sortable: true,
dataIndex: 'cicode',
header: '商品手册编号',
width: 80
},*/{
sortable: true,
dataIndex: 'ciname',
header: '商品手册名称',
width: 80
}, {
sortable: true,
dataIndex: 'AppNo',
header: '许可证号',
width: 80
}, {
sortable: true,
dataIndex: 'ValidDate',
header: '许可证有效期',
width: 80
}, {
sortable: true,
dataIndex: 'STT',
header: '双抬头',
width: 80
}, {
sortable: true, //15
dataIndex: 'printedRef',
header: '发票打印完成',
width: 80
}, {
sortable: true,
dataIndex: 'AutoAPPRef',
header: '自动证',
width: 80
}, {
sortable: true,
dataIndex: 'WriteoffsRef',
header: '核销完成',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'Mainstate',
header: 'Mainstate',
width: 80
}, {
sortable: true,
dataIndex: 'MainstateRef',
header: '合同状态',
width: 80
}, {
sortable: true,
dataIndex: 'Ex_sailingdate',
header: '预计开船日',
width: 80
}, {
sortable: true, //20
dataIndex: 'Sailingdate',
header: '开船日',
width: 80
}, {
sortable: true,
dataIndex: 'ArrivalDate',
header: '到港日',
width: 80
}, {
sortable: true,
dataIndex: 'ReceiptStatusRef',
header: '单据是否完备',
width: 80
}, {
sortable: true,
dataIndex: 'Receiptremark',
header: '寄单情况',
width: 280
}, {
sortable: true,
dataIndex: 'tax_date',
header: '出税日期',
width: 80
}, {
sortable: true, //25
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, //30
dataIndex: 'E_Billtime',
header: '电放时间',
width: 80
}, {
sortable: true,
dataIndex: 'BillTime',
header: '正本时间',
width: 80
}, {
sortable: true,
dataIndex: 'HDtime',
header: '换单时间',
width: 80
}, {
sortable: true,
dataIndex: 'ContainerNo',
header: '箱号',
width: 80
}, {
sortable: true,
dataIndex: 'SealNo',
header: '铅封号',
width: 80
}, {
sortable: true, //35
dataIndex: 'ShipCompanyRef',
header: '船公司',
width: 80
}, {
sortable: true,
dataIndex: 'Vessel',
header: '船名',
width: 80
}, {
sortable: true,
dataIndex: 'Voyage',
header: '航次',
width: 80
}, {
sortable: true,
dataIndex: 'CIQ_licence',
header: '卫生证号',
width: 80
}, {
sortable: true,
dataIndex: 'CIQ_canbesearchRef',
header: '卫生证是否可查',
width: 80
}, {
sortable: true, //40
dataIndex: 'inspection_Signup_date',
header: '报检日期',
width: 80
}, {
sortable: true,
dataIndex: 'inspection_no',
header: '报检号',
width: 80
}, {
sortable: true,
dataIndex: 'SamplingDate_Plan',
header: '海关确定抽检',
width: 80
}, {
sortable: true,
dataIndex: 'SamplingDate_Act',
header: '海关实际验货',
width: 80
}, {
sortable: true,
dataIndex: 'CustomsReleaseDate',
header: '海关放行日期',
width: 80
}, {
sortable: true, //45
dataIndex: 'DeclareNumber',
header: '报关单号',
width: 80
}, {
sortable: true,
dataIndex: 'ContractNo',
header: '合同序列号',
width: 120
}, {
sortable: true,
dataIndex: 'Paydate',
header: '付货款时间(尾款)',
width: 80
}, {
sortable: true,
dataIndex: 'Prepaydate',
header: '付货款时间(预付)',
width: 80
}, {
sortable: true,
dataIndex: 'TRADINGAGENCY',
header: '订货方(中间商)',
width: 80
}, {
sortable: true,
dataIndex: 'FactoryNo',
header: '厂号',
width: 80
}, {
sortable: true,
dataIndex: 'Audittime',
header: '审单时间',
width: 80
}, {
sortable: true,
dataIndex: 'price',
header: '单价',
width: 80
}, {
sortable: true,
dataIndex: 'amount',
header: '合同金额(对客户)',
width: 80,
summaryType: 'sum'
}, {
sortable: true,
dataIndex: 'TransactionMethodRef',
header: '成交方式',
width: 80
}, {
sortable: true,
dataIndex: 'PaymentMethodsRef',
header: '付款方式',
width: 80
}, {
sortable: true,
dataIndex: 'RCVModeREF',
header: '收单据模式',
width: 140
}, {
sortable: true,
dataIndex: 'BilltypeREF',
header: '提单交付方式',
width: 100
}, {
sortable: true,
dataIndex: 'OP',
header: '操作人',
width: 80
}, {
sortable: true,
dataIndex: 'Inspection_StorageREF',
header: '是否商检慢检',
width: 80
}, {
sortable: true,
dataIndex: 'inspection_date',
header: '商检验货日',
width: 100
}, {
sortable: true,
dataIndex: 'Sampling_needREF',
header: '海关是否抽检',
width: 100
}, {
sortable: true,
dataIndex: 'ZMQ',
header: '自贸区',
width: 100
}, {
sortable: true,
dataIndex: 'RecDate',
header: '回空日期',
width: 80
}, {
sortable: true,
dataIndex: 'PortDays',
header: '港口天数',
width: 80
}, {
sortable: true,
dataIndex: 'DeliveryDate',
header: '送货时间',
width: 80
}, {
sortable: true,
dataIndex: 'DeliveryAddress',
header: '送货地址',
width: 80
}, {
sortable: true,
dataIndex: 'BUZTYPEREF',
header: '业务类型',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'remark_2',
header: '备注2',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'remark_3',
header: '备注3',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'remark_4',
header: '备注4',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Overfilled',
header: '溢短装',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'FinanceStatusREF',
header: '融资状态',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'remark',
header: '备注1',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'price_agio',
header: '差价',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'price_limit',
header: '限价',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'boxcount',
header: '箱/件数',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'IsRongZi',
align: 'right',
header: '融资金额/收回金额',
width: 160,
renderer: function (value, meta) {
//state = DsTruck.RONGZIState(value);
showclass = DsTruck.RONGZIGetRowClass(value);
meta.tdCls = showclass;
if (showclass == '') {
return "";
} else {
return value;
}
}
}, {
sortable: true, id: '',
dataIndex: 'Freetime',
header: '免箱期',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'productiondate',
header: '生产日期',
width: 120
}, {
sortable: true, id: '',
dataIndex: 'SBYS',
header: '申报要素',
width: 120
}, {
sortable: true, id: '',
dataIndex: 'CHECKSAMPLE',
header: '样本清单已审核',
width: 90
}, {
sortable: true, id: '',
dataIndex: 'BILLTRANCNO',
header: '国外寄单快递号',
width: 120
}, {
sortable: true, id: '',
dataIndex: 'BILL_RECEIVE_DATE',
header: '单据收到时间',
width: 120
}, {
sortable: true, id: '',
dataIndex: 'BILL_SEND_DATE',
header: '单据发出时间(给客户)',
width: 120
}, {
sortable: true,
dataIndex: 'LOCK_EXCHANGERATE',
header: '是否锁汇',
width: 60,
renderer: function (value) {
if (value == "0") {
return "<a><font color='#FF0000'></font></a>";
} else if (value == "1") {
return "<a><font color='#FF0000'>锁汇</font></a>";
}
}
}, {
sortable: true,
dataIndex: 'EXCHANGERATE',
header: '锁汇汇率',
width: 60
}, {
sortable: true,
dataIndex: 'Unsealdate',
header: '慢检启封/整改放行日',
width: 80
}, {
sortable: true,
dataIndex: 'ISREFORM',
header: '是否整改',
width: 80,
renderer: function (value) {
if (value == "0") {
return "<a><font color='#0000FF'>否</font></a>";
} else if (value == "1") {
return "<a><font color='#FF0000'>是</font></a>";
}
}
}, {
sortable: true,
dataIndex: 'InspectionNo',
header: '出口商商检备案号',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'TRADECOUNTRY',
header: 'TRADECOUNTRY',
width: 80
},
{
sortable: true,
dataIndex: 'TRADECOUNTRY_REF',
header: '贸易国',
width: 80
},
{
sortable: true,
dataIndex: 'CIQDATE',
header: '卫生证日期',
width: 80
},
{
sortable: true,
dataIndex: 'VSIGN',
header: '兽医官签名',
width: 80
},
{
sortable: true,
dataIndex: 'ClearanceNo',
header: '通关单号',
width: 80
}
//后加
,
{
sortable: true,
dataIndex: 'AppNo',
header: '是否配证',
width: 80,
renderer: function (value) {
if (value != "")
return "是";
else
return "否";
}
},
{
sortable: true,
dataIndex: 'RECEIVE_MAN',
header: '接单人',
width: 80
},
{
sortable: true,
dataIndex: 'prepayments',
header: '预付款金额(应收)',
width: 100
},
{
sortable: true,
dataIndex: 'balance',
header: '尾款金额(应收)',
width: 100
},
{
sortable: true,
dataIndex: 'pay_prepayments',
header: '预付款金额(应付)',
width: 100
},
{
sortable: true,
dataIndex: 'pay_balance',
header: '尾款金额(应付)',
width: 100
}
//天津誉恒
,
{
sortable: true,
dataIndex: 'Supplier_Billno',
header: '供应商合同号',
width: 80
},
{
sortable: true,
dataIndex: 'ResendTime',
header: '分公司转单日期',
width: 80
},
{
sortable: true,
dataIndex: 'ShipAgent',
header: '船代',
width: 80
},
{
sortable: true,
dataIndex: 'BillReleaseDate',
header: '放单时间',
width: 80
},
{
sortable: true,
dataIndex: 'IsLBill',
header: '是否换小单',
width: 80
},
{
sortable: true,
dataIndex: 'LBillShipAgent',
header: '小单船代',
width: 80
},
{
sortable: true,
dataIndex: 'IsInnerLine',
header: '是否内至线',
width: 80
},
{
sortable: true,
dataIndex: 'InnerLinePort',
header: '内至线启运港',
width: 80
},
{
sortable: true,
dataIndex: 'YARD',
header: '押箱堆场',
width: 80
},
{
sortable: true,
dataIndex: 'PriceLimitDate',
header: '询回价格日期',
width: 80
},
{
sortable: true,
dataIndex: 'PriceLimitRemark',
header: '询回价格',
width: 80
},
{
sortable: true,
dataIndex: 'ClearanceDate',
header: '出通关单时间',
width: 80
},
{
sortable: true,
dataIndex: 'TaxRecvDate',
header: '税金收回日期',
width: 80
},
{
sortable: true,
dataIndex: 'GetBoxDate',
header: '车队提箱日期',
width: 80
},
{
sortable: true,
dataIndex: 'IsRec',
header: '车队未当日回空',
width: 80
},
{
sortable: true,
dataIndex: 'ResendTime2',
header: '转检时间',
width: 80
} ],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
//#endregion
//#region 固定费用明细表
//#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.storeBodyChFee = Ext.create('Ext.data.Store', {
model: 'MsChFee',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsChFee/GetDataList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.feeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.radiogroup = new Ext.form.RadioGroup({
fieldLabel: '引入方式',
width: 380,
columns: 2,
items: [
{ boxLabel: '全部引入', name: 'rb', id: 'rdall', inputValue: '1' },
{ boxLabel: '不引入客户', name: 'rb', id: 'rdfee', inputValue: '2', checked: true },
]
});
_this = this;
this.gridListChFee = new Ext.grid.GridPanel({
store: this.storeBodyChFee,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.feeGridCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
enableTextSelection: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FeeStatus');
return Shipping.FeeGetRowClass(feeStatus);
}
},
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: 'FeeName',
header: '费用名称',
width: 100
}, {
sortable: true,
dataIndex: 'CustomerType',
header: '客户类别',
width: 100
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '结算对象',
width: 120
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: '单价',
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: 'TaxRate',
header: '税率',
width: 80
}, {
sortable: true,
dataIndex: 'NoTaxAmount',
header: '不含税金额',
width: 80,
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: 'Amount',
header: '金额',
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: 'Currency',
header: '币别',
width: 60
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: '汇率',
width: 60
}, {
sortable: true,
dataIndex: 'AccTaxRate',
header: '财务税率',
width: 80
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 150
}, {
sortable: true,
dataIndex: 'FeeDescription',
header: '费用英文名称',
width: 100
}, {
sortable: true,
dataIndex: 'EnterDate',
header: '录入时间',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'MANAGERREF',
header: '责任人',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'EnterDate',
header: '录入时间',
hidden: true,
width: 200
}
],
// paging bar on the bottom
bbar: [this.radiogroup, '-', {
xtype: "button",
id: "button_add",
iconCls: "btnadd",
text: "引入费用",
handler: function (button, event) {
_this.onAddDetailClick(button, event);
}
},
'-',
{
xtype: "button",
id: "button_close",
text: "取消退出",
handler: function (button, event) {
window.close();
}
}
]
});
//#endregion
//#region formSearch
//#region formSearch枚举参照相关
// this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
// model: 'DsShipping.ux.CodeLoadportModel',
// proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' }
// });
// this.storeCodeLoadport.load();
// this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '装货港', //'装货港',
// store: this.storeCodeLoadport,
// name: 'PORTLOAD',
// valueField: 'PORT',
// displayField: 'CodeAndName',
// // forceSelection: true,
// matchFieldWidth: false
// });
// this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
// model: 'DsShipping.ux.CodeDisportModel',
// proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' }
// });
// this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '卸货港', //'卸货港',
// store: this.storeCodeDisport,
// name: 'PORTDISCHARGE',
// // forceSelection: true,
// valueField: 'PORT',
// queryMode: 'remote',
// minChars: 1,
// queryParam: 'PORT',
// displayField: 'CodeAndName'
// });
//#endregion
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',
//flex:3,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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: 'HTH',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCompany, {
fieldLabel: '从开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustDate_Min',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '至开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustDate_Max',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '接单日期',
format: 'Y-m-d',
labelWidth: 70,
xtype: 'datefield',
name: 'creattime',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '至接单日期',
format: 'Y-m-d',
labelWidth: 70,
xtype: 'datefield',
name: 'creattimeTo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}
]
}]
}]
});
//#endregion formSearch
//#region 按钮ToolBar
//#endregion
//#region 布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 55,
items: [this.formSearch]
});
this.panelBodyChFee = new Ext.Panel({
title: '费用明细',
layout: "border",
region: 'center',
margin: '5 10',
items: [this.gridListChFee]
});
this.panelFee = new Ext.Panel({
layout: "border",
region: "center",
items: [
this.panelBodyChFee
]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList, this.panelFee]
});
//#endregion
this.parentWin = window.parent.opener._thisfee;
if (this.parentWin) {
this.feeType = this.parentWin.feeType;
if (this.feeType == 1) {
this.StoreFee = this.parentWin.storeDrChFee;
} else if (this.feeType == 2) {
this.StoreFee = this.parentWin.storeCrChFee;
}
this.StoreFeeUnit = this.parentWin.StoreUnit;
this.StoreFeeCust = this.parentWin.StoreCustType;
this.StoreDateCurr = this.parentWin.StoreDateCurr;
this.StoreCurr = this.parentWin.StoreCurr;
this.EditRecord = this.parentWin.EditRecord;
this.storeCustomerNameRef = this.parentWin.storeCustomerNameRef;
}
//#region 事件绑定
this.storeList.on('beforeload', function (store) {
var sql = this.sqlcontext;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeList.on('load', function (store, records) {
if (store.getCount() > 0) {
this.gridList.getSelectionModel().select(0);
//this.gridListCheckBoxModel.selectAll();
}
}, this);
this.gridList.getSelectionModel().on('select', function (model, record, index) {
//alert(record.data.BillNo);
var bsno = record.data.ContractNo;
this.storeBodyChFee.load({ params: { billno: bsno, type: this.feeType, optype: 'import_main' } });
}, this);
//#endregion
//#region 自动刷新(已经提交但是尚未审核的业务,哪怕一票货中有一笔费用没审核也显示)
this.onAutoRefresh();
//#endregion
// this.SetBtnRight();
}, //end initUIComponents
onAutoRefresh: function () {
var myDate = new Date();
var start = new Date(myDate.getTime() - 31 * 24 * 3600 * 1000);
var mydatestr = Ext.util.Format.date(start, 'Y-m');
var sql = " B.ACCDATE='" + mydatestr + "'";
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onAddDetailClick: function (button, event) {
var type;
var rdall = Ext.getCmp('rdall');
if (rdall.checked) {
type = 1;
} else {
type = 2;
}
var myDate = new Date();
var MANAGER = '';
var MANAGERREF = '';
if (this.StoreFee.getCount() > 0) {
var memberbody = this.StoreFee.getAt(this.StoreFee.getCount() - 1);
MANAGER = memberbody.data.MANAGER;
MANAGERREF = memberbody.data.MANAGERREF;
}
selectedRecords = this.feeGridCheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
this.feeGridCheckBoxModel.selectAll();
selectedRecords = this.feeGridCheckBoxModel.selected.items;
}
for (i = 0; i < selectedRecords.length; i += 1) {
var memberyf = selectedRecords[i];
var record = null;
var records = DsStoreQueryBy(this.StoreFeeUnit, 'UNIT', memberyf.data.Unit);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var quantity = data.QUANTITY;
} else {
var quantity = 0;
}
var taxrate = memberyf.data.TaxRate;
if (taxrate == null) taxrate = 0;
var notaxamount = Mul(quantity, memberyf.data.UnitPrice);
var tax = Div(Mul(notaxamount, taxrate), 100);
var amount = Add(notaxamount, tax);
var Feetype = memberyf.data.FeeType;
var curr = memberyf.data.Currency;
var exrate = 0;
if (curr ==LOCALCURR)
{ exrate = 1 }
else {
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', curr);
if (FFrecords.getCount() > 0) {
var ffdata = FFrecords.getAt(0).data;
if (Feetype == 2)
exrate = ffdata.CRDEFRATE;
else
exrate = ffdata.DEFRATE;
} else {
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', curr);
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
if (Feetype == 2)
exrate = dfdata.CRDEFRATE;
else
exrate = dfdata.DEFRATE;
} else {
}
}
if (exrate == 0) exrate = memberyf.data.ExchangeRate;
};
var custfullname = '';
if (custname != '') {
var records = DsStoreQueryBy(this.storeCustomerNameRef, 'CustName', custname);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var DESCRIPTION = data.DESCRIPTION;
if (DESCRIPTION != '')
custfullname = DESCRIPTION;
}
}
// var amount = Ext.util.Format.number(parseFloat(notaxamount) + parseFloat(notaxamount) * parseFloat(taxrate) / 100, '0.00');
// var newsort = this.StoreFee.getCount() + 1;
var newsort = this.GetHandleSerialNo(this.StoreFee, type);
if (type == 1) {
record = Ext.create('MsChFee', {
GId: NewGuid(),
BsNo: '*',
FeeStatus: 1,
FeeStatus_Ref: '录入状态',
FeeType: memberyf.data.FeeType,
FeeName: memberyf.data.FeeName,
FeeDescription: memberyf.data.FeeDescription,
CustomerType: memberyf.data.CustomerType,
CustomerName: memberyf.data.CustomerName,
CustomerFullName: custfullname,
Unit: memberyf.data.Unit,
UnitPrice: memberyf.data.UnitPrice,
TaxUnitPrice: memberyf.data.TaxUnitPrice,
Quantity: quantity,
TaxRate: taxrate,
NoTaxAmount: notaxamount,
Amount: amount,
AccTaxRate: memberyf.data.AccTaxRate,
Currency: memberyf.data.Currency,
ExChangerate: exrate,
Reason: '',
Remark: memberyf.data.Remark,
Commissionrate: 0,
Settlement: 0,
Invoice: 0,
OrderAmount: 0,
OrderInvoice: 0,
SubmitDate: null,
Auditoperator: '',
AuditDate: null,
EnteroPerator: USERID,
OpName: SHOWNAME,
EnterDate: myDate,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
ISACC: "0",
IsAdvancedpay: "False",
Sort: newsort,
IsInvoice: "0",
FeeFrt: memberyf.data.FeeFrt,
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
LOCALCURR: LOCALCURR,
MANAGER: MANAGER,
MANAGERREF: MANAGERREF,
WmsOutBsNo: ''
});
} else {
var custtype = memberyf.data.CustomerType;
if (custtype == '') {
if (memberyf.data.FeeType == 1)
custtype = '委托单位'
else
custtype = '订舱代理'
};
var records = DsStoreQueryBy(this.StoreFeeCust, 'CUSTTYPE', custtype);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var custname = this.EditRecord.get(data.CUSTNAME);
} else {
var custname = '';
}
var custfullname = '';
if (custname != '') {
var records = DsStoreQueryBy(this.storeCustomerNameRef, 'CustName', custname);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var DESCRIPTION = data.DESCRIPTION;
if (DESCRIPTION != '')
custfullname = DESCRIPTION;
}
}
record = Ext.create('MsChFee',
{
GId: NewGuid(),
BsNo: '*',
FeeStatus: 1,
FeeStatus_Ref: '录入状态',
FeeType: memberyf.data.FeeType,
FeeName: memberyf.data.FeeName,
FeeDescription: memberyf.data.FeeDescription,
CustomerType: custtype,
CustomerName: custname,
CustomerFullName: custfullname,
Unit: memberyf.data.Unit,
UnitPrice: memberyf.data.UnitPrice,
TaxUnitPrice: memberyf.data.TaxUnitPrice,
Quantity: quantity,
TaxRate: taxrate,
NoTaxAmount: notaxamount,
Amount: amount,
AccTaxRate: memberyf.data.AccTaxRate,
Currency: memberyf.data.Currency,
ExChangerate: exrate,
Reason: '',
Remark: memberyf.data.Remark,
Commissionrate: 0,
Settlement: 0,
Invoice: 0,
OrderAmount: 0,
OrderInvoice: 0,
SubmitDate: null,
Auditoperator: '',
AuditDate: null,
EnteroPerator: USERID,
OpName: SHOWNAME,
EnterDate: myDate,
DebitNo: '',
IsDebit: "0",
IsOpen: "0",
ISACC:"0",
IsAdvancedpay: "False",
Sort: newsort,
IsInvoice: "0",
FeeFrt: memberyf.data.FeeFrt,
IsCrmOrderFee: "0",
AuditStatus: 0,
InvoiceNum: '',
ChequeNum: '',
LOCALCURR: LOCALCURR,
MANAGER: MANAGER,
MANAGERREF: MANAGERREF,
WmsOutBsNo: ''
});
}
record.id = NewGuid();
record.internalId = NewGuid();
this.StoreFee.add(record);
};
this.parentWin.onPostDetailClick(NaN, NaN, this.feeType);
this.parentWin.calcDetailTotal();
window.closeAction = 'destroy';
window.close();
},
GetHandleSerialNo: function (store, type) {
var result = 0;
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (member.data.Sort > result) {
result = member.data.Sort;
}
}
}
result = parseInt(result) + 1;
return result;
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var company = form.findField('company').getValue();
sql = sql + getAndConSql(sql, company, "M.company = '" + company + "'");
var mblNo = form.findField('HTH').getValue();
sql = sql + getAndConSql(sql, mblNo, " (M.HTH like '%" + mblNo + "%' OR M.ContractNo like '%" + mblNo + "%' or M.DeclareNumber like '%" + mblNo + "%' or M.inspection_no like '%" + mblNo + "%')");
var custDate_Min = form.findField('CustDate_Min').getRawValue();
sql = sql + getAndConSql(sql, custDate_Min, "m.SailingDate>= '" + custDate_Min + "'");
var custDate_Max = form.findField('CustDate_Max').getRawValue();
sql = sql + getAndConSql(sql, custDate_Max, "m.SailingDate<= '" + custDate_Max + " 23:59:59'");
var createtime = form.findField('creattime').getRawValue();
sql = sql + getAndConSql(sql, createtime, "m.creattime >= '" + createtime + "'");
var creattimeTo = form.findField('creattimeTo').getRawValue();
sql = sql + getAndConSql(sql, creattimeTo, "m.creattime <= '" + creattimeTo + " 23:59:59'");
return sql;
}
});