include $_SERVER['DOCUMENT_ROOT'] . "/WebBuilder/WebApp.class.php";
$db = new DBMain();
// BUILD invoice Contents
$content = '';
$index = 1;
while ($index < $_POST['rows']) {
if (strlen($_POST['item_desciption_' . $index]) < 1) {
// echo 'les than' . strlen($_POST['item_desciption_' . $index]) . " : {$_POST['item_desciption_' .$index]}";
// echo "
$index
";
} else {
$content = $content . $_POST['item_desciption_' . $index] . "," . $_POST['item_quantity_' . $index] . "," . $_POST['item_amount_' . $index] . "," . $_POST['item_discount_' . $index] . "," . $_POST['item_total_' . $index] . ";";
}
$index++;
}
$record_id = $db->insert("INSERT INTO invoices (`invoice_no`,`invoices_name`,`invoice_content`,`quotes_id`,`total`,`clients_id`,`status`,`date_created`,`date_sent`,`date_due`,`description`) values ({$_POST['invoice_no']},'{$_POST['invoice_no']}','$content',{$_POST['quote_no']},{$_POST['total']},{$_POST['client_id']},'{$_POST['status']}','{$_POST['date']}','','{$_POST['exp_date']}','{$_POST['description']}')");
if ($record_id > 0) {
echo "";
} else {
echo "ENCOUNTERED AN ERROR PLEASE TRY AGAIN";
}
// echo "";