//
//	MiscOrderForm.m -- a class to sit underneath an Order Form panel
//		Written by Don Yacktman (c) 1994 by Don Yacktman.
//				Version 1.0.  All rights reserved.
//
//		This notice may not be removed from this source code.
//
//	This object is included in the MiscKit by permission from the author
//	and its use is governed by the MiscKit license, found in the file
//	"LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
//	for a list of all applicable permissions and restrictions.
//	

#import <misckit/misckit.h>

@implementation MiscOrderForm

- init				// make sure that *Panel is nil.
{
	self = [super init];
	orderFormPanel = nil;
	return self;
}

- setController:sender { controller = sender; return self; }

- orderFormPanel		// return the orderFormPanel, load it if needed.
{
	if (!orderFormPanel)
		[NXApp loadNibSection:"OrderForm.nib" owner:self withNames:NO];
	return orderFormPanel;
}

- orderForm:sender
{
	[[self orderFormPanel] makeKeyAndOrderFront:sender];
	return self;
}

- printOrderForm:sender	// Do -costCalc and then print orderForm.
{
	// calculate the cost (extensions, etc.) before printing.
	[self costCalc:self];
	// delay the print so that the button won't be highlighted
	// on the printout.
	[[self orderFormPanel] perform:@selector(smartPrintPSCode:)
				with:self afterDelay:1 cancelPrevious:NO];
	return self;
}

- costCalc:sender
{	// This is the minimum and you'd probably want to override it.
	[self orderFormPanel]; // make sure .nib is loaded.
	[totalCostText setFloatValue:
			([numLicensesText intValue] * [costPerLicenseText floatValue])];
	return self;
}

@end
