require_once('includes/SI_Payment.php'); require_once('includes/SI_Invoice.php'); checkLogin(); if(!isset($_REQUEST['mode']) || empty($_REQUEST['mode'])){ fatal_error("Export mode must be specified!"); }elseif(strtolower($_REQUEST['mode']) == 'company'){ $company = new SI_Company(); $output = $company->exportQB(); if($output === FALSE){ fatal_error("Error getting company export data!\n".$company->getLastError()); } }elseif(strtolower($_REQUEST['mode']) == 'item_code'){ $code = new SI_ItemCode(); $output = $code->exportQB(); if($output === FALSE){ fatal_error("Error getting item code export data!\n".$code->getLastError()); } }elseif(strtolower($_REQUEST['mode']) == 'account'){ $account = new SI_Account(); $output = $account->exportQB(); if($output === FALSE){ fatal_error("Error getting account export data!\n".$account->getLastError()); } }elseif(strtolower($_REQUEST['mode']) == 'payment'){ $payment = new SI_Payment(); $output = $payment->exportQB(); if($output === FALSE){ fatal_error("Error getting payment export data!\n".$payment->getLastError()); }
if(isset($_POST['save2'])){ $output = ''; if(isset($_POST['export_companies']) && is_array($_POST['export_companies'])){ $company = new SI_Company(); $company_output = $company->exportQB("WHERE id IN (".join(',', $_POST['export_companies']).")"); if($company_output === FALSE){ fatal_error("Error getting company export data!\n".$company->getLastError()); }else{ $output .= $company_output; } } if(isset($_POST['export_item_codes']) && is_array($_POST['export_item_codes'])){ $item_code = new SI_ItemCode(); $item_code_output = $item_code->exportQB("WHERE id IN (".join(',', $_POST['export_item_codes']).")"); if($item_code_output === FALSE){ fatal_error("Error getting item_code export data!\n".$item_code->getLastError()); }else{ $output .= $item_code_output; } } if(isset($_POST['export_accounts']) && is_array($_POST['export_accounts'])){ $account = new SI_Account(); $account_output = $account->exportQB("WHERE id IN (".join(',', $_POST['export_accounts']).")"); if($account_output === FALSE){ fatal_error("Error getting account export data!\n".$account->getLastError()); }else{ $output .= $account_output; }