示例#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());
     }
 }
 $expense_array = $company->getExpenses(TRUE);
 if ($expense_array != NULL) {
     $ex_ids = '';
     foreach ($expense_array as $tempexp) {
         $ex_ids[] = $tempexp->id;
     }
     $ex_ids = array_unique($ex_ids);
 }
 if (count($ex_ids) > 0) {
     if ($invoice->addExpenses($ex_ids, SI_EXPENSE_AGGREGATION_DESC) === FALSE) {
         $error_msg .= "Error adding expenses to invoice!\n";
         debug_message($invoice->getLastError());
     }
 }
 // Add the company transaction
 if (empty($error_msg)) {
     $ct = new SI_CompanyTransaction();
     $ct->amount = $invoice->getTotal();
     $ct->company_id = $invoice->company_id;
     $ct->description = "Invoice #" . $invoice->id;
     $ct->timestamp = $invoice->timestamp;
     if ($ct->add() === FALSE) {
         $error_msg .= "Error adding company transaction!\n";
         debug_message($ct->getLastError());
     }
示例#2
0
			if(count($ta_ids) > 0){
				if($invoice->addTaskActivities($ta_ids, $_POST['activity_aggregation_type']) === FALSE){
					$error_msg .= "Error adding activities to invoice!\n";
					debug_message($invoice->getLastError());
				}
			}

			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";