//==========================================================
//WINDOW 7 - REPORTS
//==========================================================

//----------------------------------------------------------
//Window Addresse's
//----------------------------------------------------------
Fl_Double_Window*									win7p_rep;
	Fl_Input*												win7p_rep_dd;
	Fl_Input*												win7p_rep_mm;
	Fl_Input*												win7p_rep_ccyy;
	Fl_Choice*											win7p_rep_sub;
	Fl_Button*											win7p_rep_profit;
	Fl_Button*											win7p_rep_trading;
	Fl_Input*												win7p_rep_closing;
	Fl_Button*											win7p_rep_balance;

	Fl_Button*											win7p_rep_exit;

//----------------------------------------------------------
//Callbacks
//----------------------------------------------------------
void WIN7_REP_PRINT_CALLBACK(Fl_Widget* w, void* data);

//---------------------------------------------------
//WINDOW - Reportd
//---------------------------------------------------
void window7p(){

	x=60; y=120;

	win7p_rep = new Fl_Double_Window(x,y,450,150);

		x=125; y=15;

			win7p_rep_dd = new Fl_Input(x+15,y+00,20,20,"End of Period Date..:");
			win7p_rep_mm = new Fl_Input(x+40,y+00,20,20,"");
			win7p_rep_ccyy = new Fl_Input(x+65,y+00,40,20,"");
			win7p_rep_sub		= new Fl_Choice(x+70,y+25,40,20,"(S)ub or (C)ontrol Account..:");
			win7p_rep_profit = new Fl_Button(x+00,y+50,125,20,"Profit/Loss");
					win7p_rep_profit->box(FL_THIN_UP_BOX);
					win7p_rep_profit->callback(WIN7_REP_PRINT_CALLBACK,(char*)"1");

			win7p_rep_trading = new Fl_Button(x+00,y+75,125,20,"Trading Statement");
					win7p_rep_trading->box(FL_THIN_UP_BOX);
					win7p_rep_trading->callback(WIN7_REP_PRINT_CALLBACK,(char*)"2");

			win7p_rep_closing = new Fl_Input(x+225,y+75,80,20,"Closing Stock..:");

			win7p_rep_balance = new Fl_Button(x+00,y+100,125,20,"Balance Sheet");
					win7p_rep_balance->box(FL_THIN_UP_BOX);
					win7p_rep_balance->callback(WIN7_REP_PRINT_CALLBACK,(char*)"3");					

			lButton(win7p_rep_exit,x+260,y,"Exit",_windowExit_callback);

	lWindowEnd(win7p_rep,_windowExit_callback);

//------------
//Initial
//------------
	win7p_rep_sub->add("S"); win7p_rep_sub->add("C");
	win7p_rep_sub->value(0);

}

//----------------------------------------------------------
//	window 7 - PRINT
//----------------------------------------------------------
void WIN7_REP_PRINT_CALLBACK(Fl_Widget* w, void* data){

	//REPORT DATE
	dd=win7p_rep_dd->value(); if (dd.length()==1){dd='0'+dd;}
	mm=win7p_rep_mm->value(); if (mm.length()==1){mm='0'+mm;}
	ccyy=win7p_rep_ccyy->value();
	str=ccyy+'/'+mm+'/'+dd;
	l1_strcpy(str,w_Date,10);

	L1_CALL(c_B99,c_B99_ValidDate,0,0,0);
	if (RETURN_CODE!=0) 
	{
		fl_alert("Invalid Report Date");
		return;
	}	
	
	//SUB OR CONTROL ACCOUNT
	i = win7p_rep_sub->value();
	if (i==0) {	w_Sub[0]='S'; } else {	w_Sub[0]='C'; }


	//CLOSING BALANCE
	//-----------------------------------------------------------------
	//Need to drop any more than (n) decimal places 
	//-----------------------------------------------------------------
	str = win7p_rep_closing->value();
	for (i=0; i<10; i++){w_B02_Value[i]=' ';} 
	l1_strcpy(str,w_Closing,str.length());

	//REPORT NO
	str=(char*)data; x_RecNo=stoi(str);

	//MAKE THE CALL
	L1_CALL(c_B04,c_Print,x_RecNo,0,0);
	if (RETURN_CODE==0)
		{
			fromWindowNo=1; windowNo=2; win7p_rep->hide();
		}
		else
		{
			switch (RETURN_CODE)
			{
				case 01: fl_alert("Missing PA or PL Account"); break;
				case 02: fl_alert("Missing AS,TO or TC Account"); break;
			}
		}

}
