// JavaScript Document
// General Base URL
var _basse_url = "https://gs.gedco.ps/Trading";

///Module Request
var _Public_Service_Center = "JsperReport/showreport?sys=Trading/Public_Service_Center";
var _other = "JsperReport/showreport?sys=Trading/other";
var _collections = "JsperReport/showreport?sys=Trading/collections";
var _Legal_Commitments = "JsperReport/showreport?sys=Trading/Legal_Commitments";

//General Report
var _SN = $('#TXT_CURR_USER_ID').val();
const d = new Date();
var date_out = d.getFullYear()+''+d.getMonth()+''+d.getDate();
var _report_sn = _SN; 

///Functions

////print_report_general
function print_report_general(id,service_id,enlarge_type){
	var name_rep = getReportUrl(service_id,enlarge_type);
	if(name_rep !=null){
		_showReport(''+_basse_url+'/'+_Public_Service_Center+'&type=pdf&report='+name_rep+'&p_id='+id+'&sn='+_report_sn+'');
	}
}
////print_report_general
function print_report_general_2(id,name_rep){
	if(name_rep !=null){
		_showReport(''+_basse_url+'/'+_Public_Service_Center+'&type=pdf&report='+name_rep+'&p_id='+id+'&sn='+_report_sn+'');
	}
}
///
///print_report
function print_report_process(p_id,processno,name_rep){
	if(processno==0){
		danger_msg('تحذير..','اختر التعهد');
	}else{
_showReport(''+_basse_url+'/'+_Legal_Commitments+'&type=pdf&report='+name_rep+'&p_id='+p_id+'&p_processno='+processno+'&sn='+_report_sn+'');
	}
}
////getReportUrl
function getReportUrl(service_id,enlarge){
	var repName;
	switch(service_id) {
		case 3:
		case 4:
		case 5:
		case 6:
		case 7:
		case 8:
			repName = 'Electricity_Subscription';
			break;
	
		case 21:
		case 22:
			repName = "link_type_modify";
			break;
	
		case 19:
		case 20:
			repName = "classification_sub_modify";
			break;
	
		case 11:
		case 12:
			repName = "change_name";
			break;
	
		case 13:
		case 14:
			repName = "change_benef";
			break;
	
		case 57:
			repName = "change_ct";
			break;
	
		case 23:
			if(enlarge == 10) {
				repName = "Enlarge_Sub_1_To_3_One_Counter";
				break;
			}
			if(enlarge == 20) {
				repName = "Enlarge_Sub_1_To_3_One_Counters";
				break;
			}
			if(enlarge == 40) {
				repName = "Enlarge_Sub_1_To_3_One_Counter";
				break;
			}
			else {
				danger_msg('تحذير..','ادخل نوع تكبير الأمبير لعرض التقرير');
				break;
			}
			
		case 24:
				repName = "Enlarge_Sub_3_Vaz";
				break;
	
		case 55:
		case 56:
			repName = "Transfer_Subscription";
			break;
	
		case 58:
		case 59:
			danger_msg('تحذير..','لا يوجد تقرير لهذه الخدمة');
			break;
	
		case 78:
		case 79:
			danger_msg('تحذير..','لا يوجد تقرير لهذه الخدمة');
			break;
	
		case 26:
			repName = "change_mech_kvarh";
			break;
	
		case 27:
		case 28:
			repName = "change_mech_to_premeter";
			break;
	
		case 29:
		case 30:
			repName = "change_premeter_to_premeter";
			break;
	
		case 25:
			repName = "change_mech_kwh";
			break;
	
		case 108:
		case 109:
			repName = "change_premeter_to_mech";
			break;
	
		case 47:
		case 48:
			repName = "final_stop";
			break;
	
		case 45:
		case 46:
			repName = "pause_subscription_war_affected";
			break;
	
		case 51:
		case 52:
			repName = "activate_subscription";
			break;
	
		case 53:
		case 54:
			repName = "activate_subscription_war_affected";
			break;
	
		case 43:
		case 44:
			repName = "pause_subscription";
			break;
	
		case 49:
		case 50:
			repName = "final_stop_affected";
			break;
	
		case 84:
		case 86:
		case 102:
		case 90:
		case 91:
			repName = "170_Deductions/Emp_Participate_Data_Form_170";
			break;
			
		case 31:
		case 32:
			repName = "change_mech_to_smart_premeter";
			break;
			
		case 35:
		case 36:
			repName = "change_premeter_to_smart_bill";
			break;
			
		case 119:
		case 120:
			repName = "returns_excess_energy";
			break;
	
		default:
			danger_msg('تحذير..','لا يوجد تقرير لهذه الخدمة');
	}
	return repName;
}
////
function have_no_val(v) {
    if(v == null || v == 0) {
    	return v = '';
    }else {
    	return v;
    }
}