<?php
$class = $class_first = 'payment_term';
$$class = $$class_first = &$payment_term;
$class_second = 'payment_term_schedule';
$$class_second = &$payment_term_schedule;
$class_third = 'payment_term_discount';
$$class_third = &$payment_term_discount;
?>

<?php
if (!empty($_GET["payment_term_id"]) && (!is_array($_GET["payment_term_id"]))) {
 $payment_term_id = htmlentities($_GET["payment_term_id"]);
} elseif (!empty($_POST["payment_term_id"][0])) {
 $payment_term_id = $_POST["payment_term_id"][0];
} else {
 $payment_term_schedule = new payment_term_schedule();
 $payment_term_schedule_object = array();
 array_push($payment_term_schedule_object, $payment_term_schedule);

 $payment_term_discount = new payment_term_discount();
 $payment_term_discount_object = array();
 array_push($payment_term_discount_object, $payment_term_discount);
}

if (!empty($payment_term_id)) {
 $payment_term_schedule_object = payment_term_schedule::find_by_payment_termId($payment_term_id);
 if (count($payment_term_schedule_object) == 0) {
	$payment_term_schedule = new payment_term_schedule;
	$payment_term_schedule_object = array();
	array_push($payment_term_schedule_object, $payment_term_schedule);
 }
 
  $payment_term_discount_object = payment_term_discount::find_by_payment_termId($payment_term_id);
 if (count($payment_term_discount_object) == 0) {
	$payment_term_discount = new payment_term_discount;
	$payment_term_discount_object = array();
	array_push($payment_term_discount_object, $payment_term_discount);
 }
}

//check all the assigned business orgs
?>
