// <#-- Part Store -->
Ext.define('App.store.Report_PaymentStore', {
	extend: 'Ext.data.Store',

	constructor: function(cfg) {
		var me = this;
		cfg = cfg || {};
		me.callParent([Ext.apply({
			proxy: {
				type: 'ajax',
				url: App.url('/report/payment/list.json'),
				extraParams: cfg.extraParams || {},
				reader: {
					type: 'json',
					root: 'records',
					idProperty: 'orderId'
				}
			},
			fields: [
				{
					name: 'orderId',
					type: 'int',
					useNull: true
				},
				{
					name: "paymentDate",
					type: 'date',
				},
				{
					name: "type",
					type: "string",
				},{
					name: "code",
					type: "string",
				},
				{
					name: "orderNo",
					type: "string",
				},
				{
					name: "customerName",
					type: 'string'
				},
				{
					name: "orderStatus",
					type: 'int'
				},
				{
					name: 'orderAmount',
					type: 'string'
				},
				{
					name: 'currentPayment',
					type: 'string'
				},
				{
					name: 'paymentAmount',
					type: 'string'
				},
			],
		},
		cfg)]);
	}
});

Ext.define('App.store.Report_OutstandingStore', {
	extend: 'Ext.data.Store',

	constructor: function(cfg) {
		var me = this;
		cfg = cfg || {};
		me.callParent([Ext.apply({
			proxy: {
				type: 'ajax',
				url: App.url('/report/outstanding/list.json'),
				extraParams: cfg.extraParams || {},
				reader: {
					type: 'json',
					root: 'records',
					idProperty: 'orderId'
				}
			},
			fields: [
				{
					name: 'orderId',
					type: 'int',
					useNull: true
				},
				{
					name: "date",
					type: 'date',
				},
				{
					name: "type",
					type: "string",
				},{
					name: "code",
					type: "string",
				},
				{
					name: "orderNo",
					type: "string",
				},
				{
					name: "customerName",
					type: 'string'
				},
				{
					name: "status",
					type: 'int'
				},
				{
					name: 'orderAmount',
					type: 'string'
				},
				{
					name: 'outstanding',
					type: 'string'
				},
				{
					name: 'paymentAmount',
					type: 'string'
				},
			],
		},
		cfg)]);
	}
});

Ext.define('App.store.Report_OrderStore', {
	extend: 'Ext.data.Store',

	constructor: function(cfg) {
		var me = this;
		cfg = cfg || {};
		me.callParent([Ext.apply({
			proxy: {
				type: 'ajax',
				url: App.url('/report/order/list.json'),
				extraParams: cfg.extraParams || {},
				reader: {
					type: 'json',
					root: 'records',
					idProperty: 'orderId'
				}
			},
		
			fields: [
				{
					name: 'orderId',
					type: 'int',
					useNull: true
				},
				{
					name: "date",
					type: 'date',
				},
				{
					name: "type",
					type: "string",
				},{
					name: "code",
					type: "string",
				},
				{
					name: "orderNo",
					type: "string",
				},
				{
					name: "customerName",
					type: 'string'
				},
				{
					name: "status",
					type: 'int'
				},
				{
					name: "remarks",
					type: 'string'
				},
				{
					name: "item",
					type: 'string',
				},
				{
					name: 'orderAmount',
					type: 'string'
				},
				{
					name: 'outstanding',
					type: 'string'
				},
				{
					name: 'paymentAmount',
					type: 'string'
				},
			],
		},
		cfg)]);
	}
});

Ext.define('App.store.Report_CustomerStore', {
	extend: 'Ext.data.Store',

	constructor: function(cfg) {
		var me = this;
		cfg = cfg || {};
		me.callParent([Ext.apply({
			proxy: {
				type: 'ajax',
				url: App.url('/report/customer/list.json'),
				extraParams: cfg.extraParams || {},
				reader: {
					type: 'json',
					root: 'records',
					idProperty: 'orderId'
				}
			},
			fields: [
				{
					name: 'orderId',
					type: 'int',
					useNull: true
				},
				{
					name: "created",
					type: 'date',
					convert: function (value) {
						var d = new Date(value);
						return Ext.util.Format.date(d, 'Y/m/d')
					},
				},
				{
					name: "customerName",
					type: "string",
				},
				{
					name: "nameCh",
					type: "string",
				},
				{
					name: "phone1",
					type: "string",
				},
				{
					name: "phone2",
					type: 'string'
				},
				{
					name: "email",
					type: 'string'
				},
				{
					name: 'address',
					type: 'string'
				},
				{
					name: 'remarks',
					type: 'string'
				},
				{
					name: 'orderAmount',
					type: 'float'
				},
			],
		},
		cfg)]);
	}
});
