<?php
require "_header.php";

require "data/combo_student.php";
require "data/combo_semester.php";
require "data/combo_branchyear.php";
?>
<div id="main-content">
	<script type="text/javascript" src="jquery/ux/CheckColumn.js"></script>
	<link href="jquery/ux/css/superboxselect.css" rel="Stylesheet" type="text/css" />
	<link href="jquery/ux/css/summary.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="jquery/ux/SuperBoxSelect.js"></script>
	<script type="text/javascript" src="jquery/ux/GroupSummary.js"></script>
	<script type="text/javascript" src="jquery/ux/RowExpander.js"></script>
	<?php if ($_SESSION['VedantnrCollegeId'] == '1') {
		?>
		<?php
	}
	?>
	<style type="text/css">
		.x-grid3-row-over .x-grid3-cell-inner {
			font-weight: bold;
		}

		.row-preview {
			padding: 2px 2px 5px 25px;
			border-top: dotted 1px #CCCCCC;
		}

		.tplmain {
			width: 170px;
		}

		.tplleft {
			width: 120px;
		}

		.tplright {
			width: 50px;
			text-align: right;
		}

		.tblstyle {
			text-align: center;
			background-color: #CED9E7;
			border: 1px solid #99BBE8;
			color: #000;
		}

		.tblstyle th {
			text-align: center;
			font-weight: bold;
			color: #15428B;
		}

		.tblstyle td {
			padding: 2px;
		}
	</style>
	<script type="text/javascript">
		Ext.onReady(function () {
			Ext.QuickTips.init();

			var student_id, student_name;
			var labelArray;
			labelArray = [
				['Fee Type<span class="comp">*</span> '],
				['Enrollment No<span class="comp">*</span> '],
				['Course<span class="comp">*</span> '],
				['Batch Year<span class="comp">*</span> '],
				['Course Year<span class="comp">*</span> '],
				['Semester<span class="comp">*</span> '],
				['Student<span class="comp">*</span> '],
				['Total Amount '],
				['Discount '],
				['Receipt No '],
				['Receipt Date<span class="comp">*</span> '],
				['Paid by cheque '],
				['Cheque No<span class="comp">*</span> '],
				['Bank Name<span class="comp">*</span> '],
				['Comment Show '],
				['Comment ']
			];

			var branchstore = new Ext.data.ArrayStore({
				fields: ['branch_id', 'branch_name'],
				data: Ext.semester.branch
			});

			var batchyearstore = new Ext.data.ArrayStore({
				fields: ['year_id', 'year_name'],
				data: Ext.semester.yearname
			});

			var semesterstore = new Ext.data.ArrayStore({
				fields: ['branch_id', 'semester_id', 'semester_name'],
				data: Ext.student.semester
			});

			var yearstore = new Ext.data.ArrayStore({
				fields: ['branch_id', 'branchyear_id', 'branchyear_name'],
				data: Ext.year.year
			});

			var routenamestore = new Ext.data.ArrayStore({
				fields: ['route_id', 'route_name'],
				data: Ext.semester.route
			});
			var routeareastore = new Ext.data.ArrayStore({
				fields: ['head_id', 'head_name'],
				data: Ext.semester.routearea
			});
			var banknamestore = new Ext.data.ArrayStore({
				fields: ['bank_name'],
				data: Ext.semester.bankname
			});

			var studentstore = new Ext.data.JsonStore({
				url: 'data/getstudent-feesrecive.php',
				root: 'data',
				totalProperty: 'total',
				fields: [{
					name: 'student_id',
					type: 'int'
				}, {
					name: 'student_name',
					type: 'string'
				}, {
					name: 'student_gturegno',
					type: 'string'
				}, {
					name: 'adm_year',
					type: 'string'
				}, {
					name: 'student_techcerti',
					type: 'string'
				},
				{
					name: 'allsemfees',
					type: 'string'
				},
				{
					name: 'allsem_ctod',
					type: 'string'
				}

				]
			});
			var feetypestore = new Ext.data.ArrayStore({
				fields: ['type_value'],
				data: [['Regular'], ['Exam'], ['Library'], ['Stationary'], ['Transport']]
			});

			var amount_discount = new Ext.form.NumberField({
				name: 'amount_discount',
				id: 'amount_discount',
				fieldLabel: 'amount_discount ',
				width: 210,
				allowBlank: true,
				allowNegative: false,
				maxValue: 99999.993,
				decimalPrecision: 0,
				autoCreate: { tag: 'input', type: 'text', maxlength: '7' }
				//,readOnly:true
			});


			var DebitDetail = new Ext.form.Label({
				name: 'DebitDetail',
				id: 'DebitDetail'
			});

			var route_name = new Ext.form.ComboBox({
				name: 'route_name',
				id: 'route_name',
				hiddenName: 'route_hidden',
				fieldLabel: 'Route Name',
				displayField: 'route_name ',
				valueField: 'route_id',
				editable: true,
				width: 210,
				triggerAction: 'all',
				mode: 'local',
				allowBlank: true,
				store: routenamestore,
			});
			var head_name = new Ext.form.ComboBox({
				name: 'head_name',
				id: 'head_name',
				hiddenName: 'routearea_hidden',
				fieldLabel: 'Route Area',
				displayField: 'head_name ',
				valueField: 'head_name',
				editable: true,
				width: 210,
				triggerAction: 'all',
				mode: 'local',
				allowBlank: true,
				store: routeareastore,
			});
			var month_duration_from = new Ext.form.DateField({
				displayField: 'monthname',
				valueField: 'monthid',
				typeAhead: true,
				mode: 'local',
				triggerAction: 'all',
				emptyText: 'From',
				selectOnFocus: true,
				lastQuery: '',
				name: 'month_duration_from',
				id: 'month_duration_from',
				hiddenName: 'month_duration_from',
				allowBlank: true,
				labelSeparator: '',
				fieldLabel: 'Duration:',
				forceSelection: true,
				width: 100,
				editable: false
			});
			var month_duration_to = new Ext.form.DateField({
				displayField: 'month_duration_to',
				valueField: 'month_duration_to',
				typeAhead: true,
				mode: 'local',
				triggerAction: 'all',
				emptyText: 'To',
				selectOnFocus: true,
				lastQuery: '',
				name: 'month_duration_to',
				id: 'month_duration_to',
				hiddenName: 'month_duration_to',
				allowBlank: true,
				fieldLabel: '',
				forceSelection: true,
				width: 100,
				editable: false
			});
			var allsemtotalamount = new Ext.form.NumberField({
				name: 'all_receive_amt',
				id: 'all_receive_amt',
				fieldLabel: 'All Sem Amount',
				width: 210,
				disabled: true,
				maxValue: 999999.993,
				decimalPrecision: 0,
				allowBlank: true,
				allowNegative: false,
				autoCreate: { tag: 'input', type: 'text', maxlength: '7' }
				//,readOnly:true
			});
			

			var allsem = new Ext.form.Checkbox({
				name: 'allsem',
				id: 'allsem',
				tabIndex: 11,
				value: 'on',
				fieldLabel: labelArray[10],
				handler: function () {
					var is_teaching = receiveform.getForm().findField('semester_name').getValue();
					//	alert(is_teaching);
					if (Ext.getCmp('allsem').getValue(checked = true)) {
						if (is_teaching == "2") {
							//		alert("hello");
							get_feeshead_data();
							get_receivedfees_data();
						}
						Ext.getCmp('all_receive_amt').enable();
						Ext.getCmp('discount').enable();
						Ext.getCmp('total_receive_amt').enable();
						//  		Ext.getCmp('receive_amt').disable();

					}
					else {
						//			Ext.getCmp('receive_amt').enable();
						Ext.getCmp('all_receive_amt').disable();
					}
				}
			});

			var totalpayamount = new Ext.form.NumberField({
				name: 'total_receive_amt',
				id: 'total_receive_amt',
				allowDecimals: false,
				fieldLabel: 'Total Pay Amount',
				width: 210,
				disabled: true,
				allowBlank: true,
				allowNegative: false,
				allowDecimals: true,
				maxValue: 99999.993,
				decimalPrecision: 0,
				autoCreate: { tag: 'input', type: 'text', maxlength: '7' }
				//,readOnly:true
			});
			
			var allsem = new Ext.form.Checkbox({
				name: 'allsem',
				id: 'allsem',
				value: 'on',
				handler: function () {
					var is_teaching = receiveform.getForm().findField('semester_name').getValue();
					//	alert(is_teaching);
					if (Ext.getCmp('allsem').getValue(checked = true)) {
						if (is_teaching == "2") {
							//		alert("hello");
							get_feeshead_data();
							get_receivedfees_data();
						}
					//	Ext.getCmp('all_receive_amt').enable();
						Ext.getCmp('discount').enable();
				//		Ext.getCmp('total_receive_amt').enable();
						//  		Ext.getCmp('receive_amt').disable();

					}
					else {
						//			Ext.getCmp('receive_amt').enable();
						Ext.getCmp('all_receive_amt').disable();
					}
				}
			});

			/* START GRID */
			var summary = new Ext.grid.GroupSummary();

			var feeshead_fields = [{
				name: 'head_id',
				type: 'int'
			}, {
				name: 'feespaid',
				type: 'bool'
			}, {
				name: 'selected',
				type: 'bool'
			}, {
				name: 'head_name',
				type: 'string'
			}, {
				name: 'fees_type',
				type: 'string'
			}, {
				name: 'branch_id',
				type: 'int'
			}, {
				name: 'branch_name',
				type: 'string'
			}, 
			{
				name: 'year_id',
				type: 'int'
			}, {
				name: 'year_name',
				type: 'string'
			},{
				name: 'branchyear_id',
				type: 'int'
			}, {
				name: 'branchyear_name',
				type: 'string'
			},{
				name: 'semester_id',
				type: 'int'
			}, {
				name: 'semester_name',
				type: 'string'
			}, {
				name: 'fees_amount',
				type: 'float'
			}, {
				name: 'fees_recviced_amount',
				type: 'float'
			}, {
				name: 'fees_due_amount',
				type: 'float'
			},
			{
				name: 'amount_discount',
				type: 'int'
			},
			{
				name: 'all_receive_amt',
				type: 'int'
			}
			]

			var reader = new Ext.data.JsonReader({
				idProperty: 'head_id',
				root: 'data',
				fields: feeshead_fields
			});

			var feeshead_grid_store = new Ext.data.GroupingStore({
				url: 'data/view-feesreceive-data.php',
				reader: reader,
				successProperty: 'success',
				sortInfo: {
					field: 'head_id',
					autoLoad: true,
					direction: 'ASC'
				},
				groupField: 'branch_name'
			});

			var feeshead_colModel = new Ext.grid.ColumnModel([
				new Ext.grid.RowNumberer, {
					header: "FeesHead ID",
					dataIndex: 'head_id',
					width: 50,
					sortable: true,
					hidden: true
				}, {
					header: "Branch ID",
					dataIndex: 'brancg_id',
					sortable: true,
					hidden: true
				}, {
					header: "Semester ID",
					dataIndex: 'semester_id',
					sortable: true,
					hidden: true

				}, {
					xtype: 'checkcolumn',
					id: 'present',
					dataIndex: 'selected',
					width: 25
				}, {
					header: "Head Name",
					dataIndex: 'head_name',
					sortable: true,
					width: 170,
					summaryType: 'count',
					summaryRenderer: function (v, params, data) {
						return ((v === 0 || v > 1) ? + v + ' Fees' : '1 Fees');
					}
				}, {
					id: 'branch_name',
					header: "Course Name",
					width: 190,
					dataIndex: 'branch_name',
					align: 'left',
					sortable: true,
					hidden: true
				},
				{
					header: 'Receiveble Amount',
					id: 'fees_amount',
					dataIndex: 'fees_amount',
					width: 110,
					align: 'left',
					summaryType: 'sum',
					summaryRenderer: function (v, params, data) {
						return v;
					},
					groupName: 'fees_amount'
				}, {
					header: 'Received Amount',
					id: 'fees_recviced_amount',
					dataIndex: 'fees_recviced_amount',
					width: 100,
					align: 'left',
					summaryType: 'sum',
					summaryRenderer: function (v, params, data) {
						return v;
					},
					groupName: 'fees_recviced_amount'
				},
				{
					header: 'Discount Amount',
					id: 'amount_discount',
					dataIndex: 'amount_discount',
					width: 100,
					align: 'right',
					renderer: change,

				},
				{
					header: 'Due Amount',
					id: 'fees_due_amount',
					dataIndex: 'fees_due_amount',
					width: 100,
					align: 'right',
					renderer: change,
					editor: {
						xtype: 'numberfield',
						allowBlank: true,
						style: 'text-align: right;'
					},
					summaryType: 'sum',
					summaryRenderer: function (v, params, data, record) {
						Ext.getCmp('receive_amt').setValue(v);
						return v;
					},
					groupName: 'fees_due_amount'
				}

			]);

			var grid = new Ext.grid.EditorGridPanel({
				ds: feeshead_grid_store,
				cm: feeshead_colModel,
				height: 280,
				title: '',
				border: true,
				loadMask: true,
				columnLines: true,
				stripeRows: true,
				clicksToEdit: 1,
				enableHdMenu: false,
				tbar: [{ text: 'Fees Types' }],
				view: new Ext.grid.GroupingView({
					forceFit: true,
					showGroupName: false,
					enableNoGroups: false,
					hideGroupedColumn: true
				}),
				plugins: summary
			});

			grid.getStore().on('update', function (store, record, action) {
				var receive_amt = Ext.getCmp('receive_amt').getValue();

				var temp = record.data.fees_amount - record.data.fees_recviced_amount;
				//alert(temp);
				var temp1 = record.data.fees_due_amount;


				if (record.data.selected == true) {
					if (temp1 > 0) {
						record.set('fees_due_amount', temp1);
					}
					else {
						record.set('fees_due_amount', temp);
					}
				}
				else {
					record.set('fees_due_amount', 0);
				}
			});

			grid.on('render', function () {
				grid.tip = new Ext.ToolTip({
					view: grid.getView(),
					target: grid.getView().mainBody,
					delegate: '.x-grid3-row',
					trackMouse: true,
					renderTo: document.body,
					listeners: {
						beforeshow: function updateTipBody(tip) {
							tip.body.dom.innerHTML = "Click On Due Amount Column To Edit Amount.";
						}
					}
				});
			});

			Ext.override(Ext.Editor, {
				onBlur: function () {
					if (this.allowBlur === true && this.editing) {
						this.completeEdit();
					}
				}
			});
			/* END GRID */

			/* START BELOW GRID */
			var rowExpander = new Ext.grid.RowExpander({
				tpl: new Ext.Template(
					'<div class="row-preview "><p>{feeshead_detail}</p></div>'
				)
			});

			var receivedfees_fields = [{
				name: 'feesreceive_id',
				type: 'int'
			},
			{
				name: 'year_id',
				type: 'int'
			},
			{
				name: 'branchyear_id',
				type: 'int'
			},
			{
				name: 'semester_id',
				type: 'int'
			},

			{
				name: 'receipt_no',
				type: 'int'
			}, {
				name: 'receipt_date',
				type: 'date',
				dateFormat: 'Y-m-d'
			}, {
				name: 'receive_amt',
				type: 'float'
			},
			{
				name: 'discount',
				type: 'float'
			},
			{
				name: 'month_duration_from',
				type: 'date',
				dateFormat: 'Y-m-d'
			},

			{
				name: 'month_duration_to',
				type: 'date',
				dateFormat: 'Y-m-d'
			},
			{
				name: 'amount_discount',
				type: 'float'
			},
			{
				name: 'feeshead_detail',
				type: 'string'
			}, {
				name: 'cheque_no',
				type: 'int'
			}, {
				name: 'bank_name',
				type: 'string'
			}, {
				name: 'comments',
				type: 'string'
			},
			{
				name: 'year_name',
				type: 'string'
			},
			{
				name: 'fees_amount',
				type: 'int'
			},
			{
				name: 'fees_recviced_amount',
				type: 'int'
			}
			]

			var reader1 = new Ext.data.JsonReader({
				idProperty: 'feesrec_no',
				root: 'data1',
				fields: receivedfees_fields
			});

			var receivedfees_grid_store = new Ext.data.Store({
				url: 'data/view-receivedfees-data.php',
				reader: reader1
			});

			var receivedfees_colModel = new Ext.grid.ColumnModel([
				rowExpander,
				{
					header: "Branch Year",
					dataIndex: 'beanchyear_id',
					width: 60,
					align: 'center'
				},
				{
					header: "Semester",
					dataIndex: 'semester_id',
					width: 60,
					align: 'center'
				},

				{
					header: "Receipt No",
					dataIndex: 'receipt_no',
					width: 80,
					align: 'center'
				}, {
					header: "Receipt Date",
					dataIndex: 'receipt_date',
					renderer: Ext.util.Format.dateRenderer('d/m/Y'),
					width: 80
				},
				{
					header: "Month Duration From",
					dataIndex: 'month_duration_from',
					renderer: Ext.util.Format.dateRenderer('d/m/Y'),
					width: 80,
					hidden: true
				},
				{
					header: "Month Duation To",
					dataIndex: 'month_duration_to',
					renderer: Ext.util.Format.dateRenderer('d/m/Y'),
					width: 80,
					hidden: true
				},
				{
					header: 'Rec. Amount',
					id: 'receive_amt',
					align: 'right',
					dataIndex: 'receive_amt',
					width: 90
				},
				{
					header: 'Year',
					id: 'year_name',
					align: 'right',
					dataIndex: 'year_name',
					width: 80
				},
				{
					header: 'Discount',
					id: 'discount',
					align: 'right',
					dataIndex: 'discount',
					width: 90
				},

				{
					header: 'Total Amount',
					id: 'fees_amount',
					align: 'right',
					dataIndex: 'fees_amount',
					width: 90
				},
				{
					header: 'Total Rec. Amount',
					id: 'fees_recviced_amount',
					align: 'right',
					dataIndex: 'fees_recviced_amount',
					width: 90
				},

				{
					header: 'Check No',
					id: 'cheque_no',
					align: 'right',
					dataIndex: 'cheque_no',
					width: 80
				}, {
					header: 'Bank Name',
					id: 'bank_name',
					align: 'right',
					dataIndex: 'bank_name',
					width: 120
				},
				{
					header: 'Comment',
					id: 'comments',
					dataIndex: 'comments',
					width: 100
				}]);

			var grid1 = new Ext.grid.GridPanel({
				ds: receivedfees_grid_store,
				cm: receivedfees_colModel,
				//	store: feeshead_grid_store,
				loadMask: true,
				columnLines: true,
				stripeRows: true,
				sm: new Ext.grid.RowSelectionModel({
					singleSelect: true,
					listeners: {
						rowselect: function (sm, row, rec) {
							Ext.getCmp("receiveform").getForm().loadRecord(rec);
							Ext.getCmp('all_receive_amt').enable();
							Ext.getCmp('discount').enable();
							Ext.getCmp('total_receive_amt').enable();

							if (flgEdit == "true") {
								Ext.getCmp('btnSave').enable();
							}
							else {
								Ext.getCmp('btnSave').disable();
								alert('You do not have access to edit the record.');
							}

							//	Ext.getCmp("feeshead_add_edit_form").disable();
							//	grid.stopEditing();
							feeshead_grid_store.removeAll();
							feeshead_grid_store.load({
								params: {
									task: 'getdata',
									student_id: Ext.getCmp('student_name').getValue(),
									branch_id: Ext.getCmp('branch_name').getValue(),
									semester_id: Ext.getCmp('semester_name').getValue(),
									recipt_no: Ext.getCmp('receipt_no').getValue(),
									fees_type: Ext.getCmp('fees_type').getValue(),
									head_name: Ext.getCmp('head_name').getValue(),
									adm_year: Ext.getCmp('adm_year').getValue(),
									amount_discount: Ext.getCmp('amount_discount').getValue(),
									//		comment:Ext.getCmp('comment').getValue(),

									month_duration_to: Ext.getCmp('month_duration_to').getValue(),
									month_duration_from: Ext.getCmp('month_duration_from').getValue(),

									student_techcerti: Ext.getCmp('student_techcerti').getValue(),
									allsemfees: Ext.getCmp('allsemfees').getValue(),
									allsem_ctod: Ext.getCmp('allsem_ctod').getValue(),
									//gtu no
									student_gturegno: Ext.getCmp('student_gturegno').getValue(),
									allsem: Ext.getCmp('allsem').getValue(),
									//			amount_discount:Ext.getCmp('amount_discount').getValue(),
								}
							});
						}
					}
				}),
				height: 180,
				title: '',
				border: true,
				tbar: [{ text: 'Fees Receipt' }],
				enableHdMenu: false,
				plugins: rowExpander
			});

			/* END BELOW GRID */
			var receiveform = new Ext.FormPanel({
				id: 'receiveform',
				frame: true,
				url: 'save-feesrecive.php',
				labelAlign: 'left',
				bodyStyle: 'padding:5px',
				layout: 'column',
				items: [{
					columnWidth: 0.40,
					xtype: 'fieldset',
					id: 'feeshead_add_edit_form',
					labelWidth: 100,
					title: '',
					defaults: { border: false },
					autoHeight: true,
					border: false,
					items: [{
						xtype: 'combo',
						name: 'fees_type',
						allowBlank: true,
						hiddenName: 'fee_typehidden',
						id: 'fees_type',
						fieldLabel: labelArray[0],
						forceSelection: true,
						displayField: 'type_value',
						valueField: 'type_value',
						width: 210,
						tabIndex: 1,
						triggerAction: 'all',
						mode: 'local',
						store: feetypestore,
						listeners: {
							'blur': function (cmb, rec, idx) {
								get_feeshead_data();
							}
						}
					}, {
						xtype: 'textfield',
						name: 'student_gturegno',
						id: 'student_gturegno',
						tabIndex: 2,
						fieldLabel: labelArray[1],
						allowBlank: true,
						allowNegative: false,
						allowDecimals: false,
						width: 210,
						listeners: {
							'blur': function () {
								var gturegno = this.getValue();
								if (gturegno != "") {
									Ext.Ajax.request({
										loadMask: true,
										sync: true,
										url: 'data/getgtunodata.php',
										params: { gturegno: gturegno },
										success: function (resp) {
											var value = Ext.decode(resp.responseText).count;
											if (value == ',,,') {
												grid.stopEditing();
												Ext.getCmp('student_name').reset();
												Ext.getCmp('student_gturegno').reset();
												Ext.getCmp('cheque_no').reset();
												Ext.getCmp('cash').reset();
												Ext.getCmp('bank_name').reset();
												Ext.getCmp('adm_year').reset();
												Ext.getCmp('student_techcerti').reset();
												Ext.getCmp('allsemfees').reset();
												Ext.getCmp('allsem_ctod').reset();
												Ext.getCmp('receive_amt').reset();
												Ext.getCmp('comment').reset();
												Ext.getCmp('receipt_date').reset();
												Ext.getCmp('receipt_no').reset();
												Ext.getCmp('allsem').reset();
												Ext.getCmp('amount_discount').reset();
												feeshead_grid_store.removeAll();
												receivedfees_grid_store.removeAll();
												Ext.MessageBox.show({
													title: 'Message',
													msg: 'Enrollment No ' + gturegno + ' Does Not Exist...',
													buttons: Ext.MessageBox.OK,
													icon: Ext.MessageBox.INFO
												});
											} else {
												var arr_data = new Array();
												arr_data = value.split(",");
												student_id = arr_data[0];
												student_name = arr_data[1];
												branch_id = arr_data[2];
												year_id = arr_data[3];
												branchyear_id = arr_data[4];
												semester_id = arr_data[5];
												adm_year = arr_data[6];
												student_techcerti = arr_data[7];
												allsemfees = arr_data[8];
												amount_discount = arr_data[9];
												allsem_ctod = arr_data[10];

												Ext.getCmp('student_name').setValue(student_id);
												Ext.getCmp('student_name').setRawValue(student_name);
												Ext.getCmp('branch_name').setValue(branch_id);
												Ext.getCmp('year_name').setValue(year_id);
												Ext.getCmp('branchyear_name').setValue(branchyear_id);
												Ext.getCmp('semester_name').setValue(semester_id);
												Ext.getCmp('adm_year').setValue(adm_year);
												Ext.getCmp('student_techcerti').setValue(student_techcerti);
												Ext.getCmp('allsemfees').setValue(allsemfees);
												Ext.getCmp('allsem_ctod').setValue(allsem_ctod);
												Ext.getCmp('comment').setValue(comment);
												Ext.getCmp('allsem').setValue(allsem);
												Ext.getCmp('amount_discount').setValue(amount_discount);

												get_feeshead_data();
												get_receivedfees_data();
											}
										}
									});
								}
							}
						}
					},
					{
						xtype: 'combo',
						name: 'branch_name',
						id: 'branch_name',
						hiddenName: 'branch_hidden',
						fieldLabel: labelArray[2],
						displayField: 'branch_name',
						valueField: 'branch_id',
						editable: true,
						tabIndex: 4,
						width: 210,
						triggerAction: 'all',
						mode: 'local',
						allowBlank: false,
						store: branchstore,
						listeners: {
							'select': function (cmb, rec, idx) {

								Ext.getCmp('semester_name').reset();
								Ext.getCmp('student_name').reset();
								Ext.getCmp('student_gturegno').reset();
								Ext.getCmp('cheque_no').reset();
								Ext.getCmp('cash').reset();
								Ext.getCmp('bank_name').reset();
								Ext.getCmp('receive_amt').reset();
								Ext.getCmp('comment').reset();
								Ext.getCmp('receipt_date').reset();
								Ext.getCmp('receipt_no').reset();
								Ext.getCmp('adm_year').reset();
								Ext.getCmp('student_techcerti').reset();
								Ext.getCmp('allsemfees').reset();
								Ext.getCmp('allsem_ctod').reset();
								Ext.getCmp('allsem').reset();
								Ext.getCmp('amount_discount').reset();
								studentstore.removeAll();
								grid.stopEditing();

								studentstore.removeAll();
								grid.stopEditing();
								semesterstore.filter('branch_id', cmb.getValue(), false, true, true);
								yearstore.filter('branch_id', cmb.getValue(), false, true, true);
								feeshead_grid_store.removeAll();
								receivedfees_grid_store.removeAll();

								var semesterCombo = Ext.getCmp('semester_name');
								if (cmb.getValue() == 3 || cmb.getValue() == 5) {
									semesterCombo.enable();
								} else {
									semesterCombo.disable();
									semesterCombo.reset();
								}
							}
						}
					}, {
						xtype: 'combo',
						name: 'year_name',
						id: 'year_name',
						hiddenName: 'year_hidden',
						fieldLabel: labelArray[3],
						displayField: 'year_name',
						valueField: 'year_id',
						lastQuery: '',
						triggerAction: 'all',
						mode: 'local',
						width: 210,
						tabIndex: 5,
						allowBlank: true,
						store: batchyearstore,
						listeners: {
							'select': function (cmb, rec, idx) {
								if (Ext.getCmp('branch_name').getValue() != "") {
									Ext.getCmp('semester_name').reset();
									studentstore.load({ params: { 'fees_type': Ext.getCmp('fees_type').getValue(), 'branch_id': Ext.getCmp('branch_name').getValue(), 'year_id': Ext.getCmp('year_name').getValue() } });

								} else {
									this.reset();
								}
							}
						}
					}, {
						xtype: 'combo',
						name: 'branchyear_name',
						id: 'branchyear_name',
						hiddenName: 'branchyear_hidden',
						tabIndex: 6,
						width: 210,
						fieldLabel: labelArray[4],
						displayField: 'branchyear_name',
						valueField: 'branchyear_id',
						editable: true,
						triggerAction: 'all',
						mode: 'local',
						lastQuery: '',
						allowBlank: true,
						store: yearstore,
						listeners: {
							'select': function (cmb, rec, idx) {
								var branch = Ext.getCmp('branch_name').getValue();
								var fees_type = Ext.getCmp('fees_type').getValue();
								var branchyear = Ext.getCmp('branchyear_name').getValue();

								if (Ext.getCmp('branch_name').getValue() != "") {
									get_ReceiptNo();
									grid.stopEditing();
									feeshead_grid_store.removeAll();
									receivedfees_grid_store.removeAll();
									Ext.getCmp('student_name').reset();
									Ext.getCmp('student_gturegno').reset();
									Ext.getCmp('cheque_no').reset();
									Ext.getCmp('cash').reset();
									Ext.getCmp('bank_name').reset();
									Ext.getCmp('receive_amt').reset();
									Ext.getCmp('comment').reset();
									Ext.getCmp('receipt_date').reset();
									Ext.getCmp('receipt_no').reset();
									Ext.getCmp('allsem').reset();
									Ext.getCmp('amount_discount').reset();
									studentstore.load({ params: { 'fees_type': Ext.getCmp('fees_type').getValue(), 'branch_id': Ext.getCmp('branch_name').getValue(), 'branchyear_id': Ext.getCmp('branchyear_name').getValue() } });
								} else {
									alert('Select Branch First')
									this.reset();
								}
							}
						}
					}, {
						xtype: 'combo',
						name: 'semester_name',
						id: 'semester_name',
						hiddenName: 'semester_hidden',
						tabIndex: 7,
						width: 210,
						fieldLabel: labelArray[5],
						displayField: 'semester_name',
						valueField: 'semester_id',
						disabled: true,
						triggerAction: 'all',
						mode: 'local',
						lastQuery: '',
						allowBlank: true,
						store: semesterstore,
						listeners: {
							'select': function (cmb, rec, idx) {
								var branch = Ext.getCmp('branch_name').getValue();
								var fees_type = Ext.getCmp('fees_type').getValue();
								var semeseter = Ext.getCmp('semester_name').getValue();

								if (Ext.getCmp('branch_name').getValue() != "") {
									get_ReceiptNo();
									grid.stopEditing();
									feeshead_grid_store.removeAll();
									receivedfees_grid_store.removeAll();
									Ext.getCmp('student_name').reset();
									Ext.getCmp('student_gturegno').reset();
									Ext.getCmp('cheque_no').reset();
									Ext.getCmp('cash').reset();
									Ext.getCmp('bank_name').reset();
									Ext.getCmp('receive_amt').reset();
									Ext.getCmp('comment').reset();
									Ext.getCmp('receipt_date').reset();
									Ext.getCmp('receipt_no').reset();
									Ext.getCmp('allsem').reset();
									Ext.getCmp('amount_discount').reset();
									studentstore.load({ params: { 'fees_type': Ext.getCmp('fees_type').getValue(), 'branch_id': Ext.getCmp('branch_name').getValue(), 'semester_id': Ext.getCmp('semester_name').getValue() } });
								} else {
									alert('Select Branch First')
									this.reset();
								}
							}
						}
					}, {
						xtype: 'combo',
						name: 'student_name',
						id: 'student_name',
						hiddenName: 'student_hidden',
						fieldLabel: labelArray[6],
						displayField: 'student_name',
						valueField: 'student_id',
						editable: true,
						tabIndex: 8,
						width: 210,
						triggerAction: 'all',
						mode: 'local',
						allowBlank: true,
						forceSelection: false,
						store: studentstore,
						listeners: {
							'select': function (cmb, rec, idx) {
								if (Ext.getCmp('branch_name').getValue() != "" && Ext.getCmp('year_name').getValue() != "") {
									Ext.getCmp('student_gturegno').setValue(studentstore.getAt(idx).data.student_gturegno);
									Ext.getCmp('adm_year').setValue(studentstore.getAt(idx).data.adm_year);
									Ext.getCmp('student_techcerti').setValue(studentstore.getAt(idx).data.student_techcerti);
									Ext.getCmp('allsemfees').setValue(studentstore.getAt(idx).data.allsemfees);
									Ext.getCmp('allsem_ctod').setValue(studentstore.getAt(idx).data.allsem_ctod);
									get_feeshead_data();
									get_receivedfees_data();
									get_ReceiptNo();
									student_id = this.getValue();
									student_name = this.getRawValue();
								} else if (Ext.getCmp('branch_name').getValue() != "" && Ext.getCmp('branchyear_name').getValue() != "") {
									Ext.getCmp('student_gturegno').setValue(studentstore.getAt(idx).data.student_gturegno);
									Ext.getCmp('adm_year').setValue(studentstore.getAt(idx).data.adm_year);
									Ext.getCmp('student_techcerti').setValue(studentstore.getAt(idx).data.student_techcerti);
									Ext.getCmp('allsemfees').setValue(studentstore.getAt(idx).data.allsemfees);
									Ext.getCmp('allsem_ctod').setValue(studentstore.getAt(idx).data.allsem_ctod);
									get_feeshead_data();
									get_receivedfees_data();
									get_ReceiptNo();
									student_id = this.getValue();
									student_name = this.getRawValue();
								} else if (Ext.getCmp('branch_name').getValue() != "" && Ext.getCmp('semester_name').getValue() != "") {
									Ext.getCmp('student_gturegno').setValue(studentstore.getAt(idx).data.student_gturegno);
									Ext.getCmp('adm_year').setValue(studentstore.getAt(idx).data.adm_year);
									Ext.getCmp('student_techcerti').setValue(studentstore.getAt(idx).data.student_techcerti);
									Ext.getCmp('allsemfees').setValue(studentstore.getAt(idx).data.allsemfees);
									Ext.getCmp('allsem_ctod').setValue(studentstore.getAt(idx).data.allsem_ctod);
									get_feeshead_data();
									get_receivedfees_data();
									get_ReceiptNo();
									student_id = this.getValue();
									student_name = this.getRawValue();
								} else {
									alert('Select Branch And Semester First')
									this.reset();
								}
							},
							'focus': function (cmb, rec, idx) {
								student_id = this.getValue();
								student_name = this.getRawValue();
							},
							'blur': function (cmb, rec, idx) {
								this.setValue(student_id);
								this.setRawValue(student_name);
							}
						}
					},
					/*{
						xtype       : 'container',
						autoEl      : {},
						border      : false,
						layout      : 'column',
						anchor      : '100%',
						defaultType : 'field',
						items       : [{
										xtype  : 'container',
										autoEl : {},
										layout : 'form',
										columnWidth : .51,
										items  : [month_duration_from]
									},
								{
											xtype : 'container',
											autoEl : {},
											layout : 'form',
											columnWidth : .39,
											labelWidth : 1,
												items 	 : [month_duration_to]
								}]
					},*/
					{
						xtype: 'numberfield',
						name: 'receive_amt',
						id: 'receive_amt',
						fieldLabel: labelArray[7],
						width: 210,
						tabIndex: 9,
						allowBlank: true,
						allowNegative: false,
						maxValue: 99999.993,
						decimalPrecision: 0,
						autoCreate: { tag: 'input', type: 'text', maxlength: '7' }
						//,readOnly:true
					}, {
						xtype: 'numberfield',
						name: 'discount',
						id: 'discount',
						fieldLabel: labelArray[8],
						width: 210,
						tabIndex: 10,
						disabled: false,
						allowBlank: true,
						allowNegative: false,
						allowDecimals: true,
						maxValue: 99999.993,
						decimalPrecision: 4,
						autoCreate: { tag: 'input', type: 'text', maxlength: '8' },
						//,readOnly:true,
						listeners:
						{
							onBlur: function () {
								alert("hello");
							}
						}
					}, {
						xtype: 'numberfield',
						id: 'receipt_no',
						name: 'receipt_no',
						width: 210,
						tabIndex: 11,
						fieldLabel: labelArray[9],
						//readOnly:true
					}, {
						xtype: 'datefield',
						id: 'receipt_date',
						name: 'receipt_date',
						width: 210,
						tabIndex: 12,
						fieldLabel: labelArray[10],
						enableKeyEvents: true,
						allowBlank: true,
						maxValue: new Date(),
						value: new Date()
					}, {
						xtype: 'checkbox',
						name: 'cash',
						id: 'cash',
						tabIndex: 13,
						fieldLabel: labelArray[11]
					}, {
						xtype: 'numberfield',
						name: 'cheque_no',
						id: 'cheque_no',
						tabIndex: 14,
						fieldLabel: labelArray[12],
						allowNegative: false,
						allowDecimals: false,
						disabled: true,
						width: 210,
						autoCreate: { tag: 'input', type: 'text', maxlength: '15' },
						allowBlank: true
					}, {
						xtype: 'combo',
						name: 'bank_name',
						id: 'bank_name',
						fieldLabel: labelArray[13],
						displayField: 'bank_name',
						triggerAction: 'all',
						hideTrigger: true,
						tabIndex: 15,
						disabled: true,
						store: banknamestore,
						mode: 'local',
						width: 210,
						selectOnFocus: true,
						allowBlank: true
					}, {
						xtype: 'checkbox',
						name: 'comment_show',
						id: 'comment_show',
						tabIndex: 16,
						fieldLabel: labelArray[14]
					},
					{
						xtype: 'checkbox',
						id: 'comment',
						name: 'comment',
						width: 210,
						tabIndex: 17,
						fieldLabel: labelArray[15]
					}, {
						xtype: 'textfield',
						id: 'adm_year',
						name: 'adm_year',
						hidden: true
					}, {
						xtype: 'textfield',
						id: 'student_techcerti',
						name: 'student_techcerti',
						hidden: true
					},
					{
						xtype: 'textfield',
						id: 'allsemfees',
						name: 'allsemfees',
						hidden: true
					},
					{
						xtype: 'textfield',
						id: 'allsem_ctod',
						name: 'allsem_ctod',
						hidden: true
					}, {
						xtype: 'textfield',
						name: 'feesreceive_id',
						id: 'feesreceive_id',
						hidden: true
					},

						DebitDetail
					]
				}, {
					columnWidth: 0.60,
					xtype: 'container',
					border: false,
					layout: 'column',
					defaultType: 'field',
					items: [{
						xtype: 'container',
						columnWidth: 1,
						items: [grid]
					}, {
						xtype: 'container',
						columnWidth: 1,
						items: [grid1]
					}]
				}]
			});



			function change(val) {
				if (val > 0) {
					return '<span style="color:red;">' + val + '</span>';
				}
				else if (val <= 0) {
					return '<span style="color:green;">' + val + '</span>';
				}
				return val;
			}

			function get_receivedfees_data() {

				var student_id = Ext.getCmp('student_name').getValue();
				//gtu no
				var student_gturegno = Ext.getCmp('student_gturegno').getValue();
				var adm_year = Ext.getCmp('adm_year').getValue();
				var student_techcerti = Ext.getCmp('student_techcerti').getValue();
				var branch_id = Ext.getCmp('branch_name').getValue();
				var allsemfees = Ext.getCmp('allsemfees').getValue();
				var allsem_ctod = Ext.getCmp('allsem_ctod').getValue();
				var semester_id = Ext.getCmp('semester_name').getValue();
				var allsem = Ext.getCmp('allsem').getValue();
				var amount_discount = Ext.getCmp('amount_discount').getValue();

				receivedfees_grid_store.removeAll();
				receivedfees_grid_store.load({
					params: {
						student_id: student_id,
						branch_id: branch_id,
						semester_id: semester_id,
						discount: discount,
						student_gturegno: student_gturegno,
						adm_year: adm_year
					}
				});
			}
			receiveform.getForm().findField('discount').on('blur', function () {

				var discount = receiveform.getForm().findField('discount').getValue();

				//var all_receive_amt = receiveform.getForm().findField('all_receive_amt').getValue();

				var amount = receiveform.getForm().findField('receive_amt').getValue();



				var t = 0;
				for (k = 0; k < feeshead_grid_store.getCount(); k++) {
					var record = feeshead_grid_store.getAt(k);
					t = t + record.data.fees_due_amount;

				}
				amount = t - discount;
				var total = amount - discount;
				Ext.getCmp('receive_amt').enable();
				Ext.getCmp('receive_amt').setValue(total);


			});


			function get_feeshead_data() {
				grid.stopEditing();
				feeshead_grid_store.removeAll();
				feeshead_grid_store.load({
					params: {
						task: 'getdata',
						student_id: Ext.getCmp('student_name').getValue(),
						branch_id: Ext.getCmp('branch_name').getValue(),
						semester_id: Ext.getCmp('semester_name').getValue(),
						fees_type: Ext.getCmp('fees_type').getValue(),
						head_name: Ext.getCmp('head_name').getValue(),
						adm_year: Ext.getCmp('adm_year').getValue(),
						month_duration_to: Ext.getCmp('month_duration_to').getValue(),
						month_duration_from: Ext.getCmp('month_duration_from').getValue(),
						student_techcerti: Ext.getCmp('student_techcerti').getValue(),
						allsemfees: Ext.getCmp('allsemfees').getValue(),
						allsem_ctod: Ext.getCmp('allsem_ctod').getValue(),
						receipt_no: Ext.getCmp('receipt_no').getValue(),
						//gtu no
						student_gturegno: Ext.getCmp('student_gturegno').getValue(),
						allsem: Ext.getCmp('allsem').getValue(),
						amount_discount: Ext.getCmp('amount_discount').getValue()
					}
				});
			}

			function get_ReceiptNo() {
				var branch_id = Ext.getCmp('branch_name').getValue();
				var semester_id = Ext.getCmp('semester_name').getValue();
				var branchyear_id = Ext.getCmp('branchyear_name').getValue();
				Ext.Ajax.request({
					loadMask: true,
					sync: true,
					params: { branch_id: branch_id, semester_id: semester_id, branchyear_id: branchyear_id },
					url: 'data/getReceiptno.php',
					success: function (resp) {
						var value = Ext.decode(resp.responseText).count;



						Ext.getCmp('receipt_no').setValue(value);


					}
				});
			}


			function toggleflag(btn) {
				flag = true;
			}

			function deleteallowances(btn) {
				if (btn == 'yes') {
					//window.location='fees-receipt-report.php?receipt_no=' + Ext.getCmp('receipt_no').getValue();
					window.location = 'fees-receipt-report.php';
				}
				else {
					receiveform.getForm().reset();
					feeshead_grid_store.removeAll();
					receivedfees_grid_store.removeAll();
					Ext.getCmp("feeshead_add_edit_form").enable();
					//Ext.getCmp('branch_name').focus(true,500);
					Ext.getCmp('fees_type').focus(true, 500);
					Ext.getCmp('fees_type').setValue('Regular');
					//get_ReceiptNo();	
				}
			}
			// function deleteallowances2(btn) {
			// 	if (btn == 'yes') {
			// 		//window.location='fees-receipt-report.php?receipt_no=' + Ext.getCmp('receipt_no').getValue();
			// 		window.location = 'fees-receipt-report2.php';
			// 	}
			// 	else {
			// 		receiveform.getForm().reset();
			// 		feeshead_grid_store.removeAll();
			// 		receivedfees_grid_store.removeAll();
			// 		Ext.getCmp("feeshead_add_edit_form").enable();
			// 		//Ext.getCmp('branch_name').focus(true,500);
			// 		Ext.getCmp('fees_type').focus(true, 500);
			// 		Ext.getCmp('fees_type').setValue('Transport');

			// 		//get_ReceiptNo();
			// 	}
			// }
			function deleteallowances1(btn) {
				if (btn == 'yes') {

					var branch_id = Ext.getCmp('branch_name').getValue();
					if (branch_id == 9) {
						window.location = 'fees-receipt-law-report1.php?branch_id=' + Ext.getCmp('branch_name').getValue() + '&semester_id=' + Ext.getCmp('semester_name').getValue() + '&receipt_no=' + Ext.getCmp('receipt_no').getValue();
					}
					else {
						window.location = 'fees-receipt-report1.php?branch_id=' + Ext.getCmp('branch_name').getValue() + '&semester_id=' + Ext.getCmp('semester_name').getValue() + '&receipt_no=' + Ext.getCmp('receipt_no').getValue();
					}

				}
				else {
					receiveform.getForm().reset();
					feeshead_grid_store.removeAll();
					receivedfees_grid_store.removeAll();
					Ext.getCmp("feeshead_add_edit_form").enable();
					//Ext.getCmp('branch_name').focus(true,500);
					Ext.getCmp('fees_type').focus(true, 500);
					Ext.getCmp('fees_type').setValue('Regular');
					//get_ReceiptNo();
				}
			}
			var SetupWindow = new Ext.Window({
				title: 'Fees Receipt Master',
				width: 1100,
				height: 550,
				frame: true,
				border: false,
				modal: true,
				layout: 'fit',
				closeAction: 'close',
				collapsible: true,
				items: receiveform,
				buttons: [{
					text: 'Save',
					tabIndex: 13,
					name: 'btnSave',
					iconCls: 'icon-save',
					id: 'btnSave',
					handler: function () {
						var flag = 0;
						var student_id = Ext.getCmp('student_name').getValue();
						Ext.Ajax.request({
							loadMask: true,
							sync: true,
							url: 'data/checknewadmission.php',
							params: { student_id: student_id },
							success: function (resp) {
								var feesflag = Ext.decode(resp.responseText).feesflag;
								feesflag = 1;

								if (feesflag == '0') {

									Ext.MessageBox.show({
										title: 'Message',
										msg: 'Please Contact to director to verify the documents of this student!',
										buttons: Ext.MessageBox.OK,
										icon: Ext.MessageBox.INFO
									});
									Ext.getCmp("btnreset").handler.call(Ext.getCmp("btnreset").scope);
									//Ext.getCmp('btnreset').fireEvent('click',Ext.getCmp('btnreset'));

								}
								else {
									var check = Ext.getCmp('allsem').getValue(checked = true)

									if (check == false) {
										if (Ext.getCmp('receive_amt').getValue() > -1) {
											grid.stopEditing();
											var headids = new Array();
											var recivedamt = new Array();
											var l = 0;
											for (var i = 0, len = grid.store.getCount(); i < len; i++) {
												record = grid.store.getAt(i);
												headids[l] = record.data.head_id;
												//alert(record.data.head_id);
												//alert(record.data.fees_due_amount);

												if (record.data.fees_due_amount != null) {
													recivedamt[l] = record.data.fees_due_amount;
												}
												else {
													recivedamt[l] = 0;
												}
												l++;
											}
											receiveform.getForm().submit({
												waitMsg: 'Saving...',
												timeout: 3000,
												params: {
													headids: Ext.util.JSON.encode(headids),
													recivedamt: Ext.util.JSON.encode(recivedamt)
												},
												success: function (resp) {
													//alert(resp.responseText);
													Ext.MessageBox.confirm('Confirmation', ' Do U Want To Print Receipt..?', deleteallowances);
												},
												failure: function () {
													Ext.MessageBox.show({
														title: 'Error',
														msg: 'Please fill up complete form.',
														buttons: Ext.MessageBox.OK,
														icon: Ext.MessageBox.ERROR
													});
												}
											});
										}
										else {
											alert("No Dabit Amount For this Record...")

										}
									}
								}

							}
						});
					}
				}, {
					text: 'Reset',
					name: 'btnreset',
					tabIndex: 14,
					iconCls: 'icon-reset',
					id: 'btnreset',
					handler: function () {

						receiveform.getForm().reset();
						grid.stopEditing();
						feeshead_grid_store.removeAll();
						receivedfees_grid_store.removeAll();
						Ext.getCmp("feeshead_add_edit_form").enable();
						get_ReceiptNo();
						if (flgAdd == "true") {
							Ext.getCmp('btnSave').enable();
						}
						Ext.getCmp('fees_type').focus(true, 500);
						Ext.getCmp('fees_type').setValue('Regular');
					}
				}, {
					text: 'Close',
					name: 'btnclose',
					tabIndex: 15,
					iconCls: 'icon-close',
					id: 'btnclose',
					handler: function () {
						SetupWindow.close();
					}
				}]
			});


			Ext.getCmp('cash').on('check', function () {
				if (Ext.getCmp('cash').getValue() == false) {
					Ext.getCmp('bank_name').reset();
					Ext.getCmp('cheque_no').reset();
					Ext.getCmp('bank_name').disable();
					Ext.getCmp('cheque_no').disable();
				}
				else {
					Ext.getCmp('bank_name').enable();
					Ext.getCmp('cheque_no').enable();
				}
			});



			Ext.getCmp('receipt_date').on('select', function () {
				if (Ext.getCmp('receipt_no').getValue() != "") {
					Ext.Ajax.request({
						loadMask: true,
						sync: true,
						url: 'data/getfeesreceiptdaterange.php',
						params: {
							year_id: Ext.getCmp('year_name').getValue(),
							branchyear_id: Ext.getCmp('branchyear_name').getValue(),
							semester_id: Ext.getCmp('semester_name').getValue(),
							feesrec_no: Ext.getCmp('receipt_no').getValue(),
							date: Ext.getCmp('receipt_date').getValue(),

						},
						waitMsg: 'Loading',
						success: function (resp) {
							if (Ext.decode(resp.responseText).valid == "true") {
								flag = true;
							}
							else {
								flag = false;
								var date = Ext.decode(resp.responseText).valid;
								var feesrec_no = Ext.getCmp('receipt_no').getValue();
								feesrec_no = feesrec_no - 1;
								Ext.MessageBox.alert("Error", "Recipt Date Should Not Less than " + date + " See Receipt No " + feesrec_no, toggleflag);
								Ext.getCmp('receipt_date').reset();
							}
						}
					});
				}
				else {
					alert("Select Semester First");
					Ext.getCmp('receipt_date').reset();
				}
			});

			feeshead_grid_store.on({
				'load': {
					fn: function () {
						if (feeshead_grid_store.getCount() <= 0) {
							Ext.MessageBox.show({
								title: 'Error',
								msg: 'Fees Setup Not found For This Selection.',
								buttons: Ext.MessageBox.OK,
								icon: Ext.MessageBox.ERROR
							});
						}
						else {
							grid.startEditing(0, 8);
						}
					}
				}
			});

			var varWidth = (screen.width - SetupWindow.width) / 2;
			SetupWindow.setPosition(varWidth, ((screen.height / 4) - 190));
			SetupWindow.show();

			if (flgAdd == "true") {
				Ext.getCmp('btnSave').enable();
			}
			else {
				Ext.getCmp('btnSave').disable();
			}

			Ext.getCmp('fees_type').focus(true, 500);
			Ext.getCmp('fees_type').setValue('Regular');
		});
	</script>
</div>
<?php require "_footer.php"; ?>