FUNCTION calc_ticket_values (coming_data_of varchar2) RETURN number IS

temp_count number;

cursor k1 is
select sum(tkt_value) from ke014t3_support.bcd_ict_bill_dept_stat_ds where data_of=coming_data_of;

Begin
	
	Open k1;
	fetch k1 into temp_count;
	close k1;
	return temp_count;
	 
END;



Begin
			go_block('BCD_ICT_UNINV_TCWISE_CUST_DATA');
			set_block_property('BCD_ICT_UNINV_TCWISE_CUST_DATA', default_where, 'where TC=:parameter.P_TC');		
			execute_query();
			go_item('TICKET_CUSTOMER_1');
end;


declare
temp_id paramlist;
begin
temp_id := CREATE_PARAMETER_LIST('V_A');

ADD_PARAMETER(temp_id,'P_TC',text_parameter,:TC);

CALL_FORM('z:\fmxs\tc_wise_cust_wise_not_inv_tkt.fmx',NO_HIDE,DO_REPLACE,NO_QUERY_ONLY,TEMP_ID);
destroy_parameter_list(temp_id);
END;



DEFAULT&SMARTBAR

declare
temp_id3 paramlist;
begin
temp_id3 := CREATE_PARAMETER_LIST('V_A');

ADD_PARAMETER(temp_id3,'P_EXECUTIVE',text_parameter,:BCD_ICT_UNINV_TCWISE_CUST_DATA.TC);

CALL_FORM('z:\fmxs\tcwise_tkt_details_not_inv.fmx',NO_HIDE,DO_REPLACE,NO_QUERY_ONLY,TEMP_ID3);
destroy_parameter_list(temp_id3);
END;


	-- Autofit columns
		

		range := OLE2.GET_OBJ_PROPERTY( worksheet,'UsedRange');
		range_col := OLE2.GET_OBJ_PROPERTY( range,'Columns');
		OLE2.INVOKE( range_col,'AutoFit' );
		OLE2.RELEASE_OBJ( range );
		OLE2.RELEASE_OBJ( range_col );

		-- Save as worksheet with a Specified file path & name.
		IF NVL(filename,'0')<>'0' THEN
			 args := OLE2.CREATE_ARGLIST;
			         OLE2.ADD_ARG(args,filename );
			 				 OLE2.INVOKE(worksheet,'SaveAs',args );
			 				 OLE2.DESTROY_ARGLIST( args );
		END IF;
		
		--	 Release the OLE objects
		OLE2.RELEASE_OBJ(worksheet);
		OLE2.RELEASE_OBJ(worksheets);
		OLE2.RELEASE_OBJ(workbook);
		OLE2.RELEASE_OBJ(workbooks);
		OLE2.INVOKE     (application,'Quit');
		OLE2.RELEASE_OBJ(application);
		

 application := ole2.create_obj('Excel.Application');
workbooks := ole2.get_obj_property(application, 'Workbooks');

-- Open the required workbook
args:= ole2.create_arglist;
ole2.add_arg(args, user_file_name);
workbook := ole2.invoke_obj(workbooks, 'Open', args);
ole2.destroy_arglist(args);

worksheets := ole2.get_obj_property(workbook, 'Worksheets');

range := OLE2.GET_OBJ_PROPERTY( worksheet,'UsedRange');
		range_col := OLE2.GET_OBJ_PROPERTY( range,'Columns');
		OLE2.INVOKE( range_col,'AutoFit' );
		OLE2.RELEASE_OBJ( range );
		OLE2.RELEASE_OBJ( range_col );

-- Save as worksheet with a Specified file path & name.
		IF NVL(user_file_name,'0')<>'0' THEN
			 args := OLE2.CREATE_ARGLIST;
			         OLE2.ADD_ARG(args,user_file_name );
			 				 OLE2.INVOKE(worksheet,'SaveAs',args );
			 				 OLE2.DESTROY_ARGLIST( args );
			 				 
			 				 ole2.release_obj(worksheet);
ole2.release_obj(worksheets);
ole2.release_obj(workbook);
ole2.release_obj(workbooks);
ole2.release_obj(application);
		END IF;




https://web.powerapps.com/apps/e55a0078-47a0-4380-9d64-c8fa79b49513?tenantId=4ff6a9bd-1bfb-4405-8fec-92979e12e0f2       new

web.powerapps.com/apps/239e397c-4ca5-4fe7-8d6b-fa443056eeaa  - OLD