Example #1
0
			if(count($ps_ids) > 0){
				if($invoice->addPaymentSchedules($ps_ids) === FALSE){
					$error_msg .= "Error adding payment schedules to invoice!\n";
					debug_message($invoice->getLastError());
				}
			}

			if(count($ex_ids) > 0){
				if($invoice->addExpenses($ex_ids, $_POST['expense_aggregation_type']) === FALSE){
					$error_msg .= "Error adding expenses to invoice!\n";
					debug_message($invoice->getLastError());
				}
			}

			// Add custom line items
			if($invoice->addCustomLines($_REQUEST['custom']) === FALSE){
				$error_msg .= "Error adding custom line items to invoice!\n";
				debug_message($invoice->getLastError());
			}
			
			//Add discount line
			if($_POST['discount_line'] == 'Y'){
				if($invoice->addDiscountLine() === FALSE){
					$error_msg = "Error calculating discount line\n";
					debug_message($invoice->getLastError());	
				}
			}
			
			// Add the company transaction
			if(empty($error_msg)){
				$ct = new SI_CompanyTransaction();