public function testSaveAndMark_deleted() { error_reporting(E_ERROR | E_PARSE); $aosInvoices = new AOS_Invoices(); $aosInvoices->name = 'test'; $aosInvoices->save(); //test for record ID to verify that record is saved $this->assertTrue(isset($aosInvoices->id)); $this->assertEquals(36, strlen($aosInvoices->id)); $this->assertGreaterThan(0, $aosInvoices->number); //mark the record as deleted and verify that this record cannot be retrieved anymore. $aosInvoices->mark_deleted($aosInvoices->id); $result = $aosInvoices->retrieve($aosInvoices->id); $this->assertEquals(null, $result); }
global $timedate; //Setting values in Quotes $quote = new AOS_Quotes(); $quote->retrieve($_REQUEST['record']); $quote->invoice_status = 'Invoiced'; $quote->total_amt = format_number($quote->total_amt); $quote->discount_amount = format_number($quote->discount_amount); $quote->subtotal_amount = format_number($quote->subtotal_amount); $quote->tax_amount = format_number($quote->tax_amount); if ($quote->shipping_amount != null) { $quote->shipping_amount = format_number($quote->shipping_amount); } $quote->total_amount = format_number($quote->total_amount); $quote->save(); //Setting Invoice Values $invoice = new AOS_Invoices(); $rawRow = $quote->fetched_row; $rawRow['id'] = ''; $rawRow['template_ddown_c'] = ' '; $rawRow['quote_number'] = $rawRow['number']; $rawRow['number'] = ''; $dt = explode(' ', $rawRow['date_entered']); $rawRow['quote_date'] = $dt[0]; $rawRow['invoice_date'] = date('Y-m-d'); $rawRow['total_amt'] = format_number($rawRow['total_amt']); $rawRow['discount_amount'] = format_number($rawRow['discount_amount']); $rawRow['subtotal_amount'] = format_number($rawRow['subtotal_amount']); $rawRow['tax_amount'] = format_number($rawRow['tax_amount']); $rawRow['date_entered'] = ''; $rawRow['date_modified'] = ''; if ($rawRow['shipping_amount'] != null) {
<?php if (!isset($_REQUEST['record']) || empty($_REQUEST['record']) || !isset($_REQUEST['templateID']) || empty($_REQUEST['templateID'])) { die('Error retrieving record. This record may be deleted or you may not be authorized to view it.'); } error_reporting(0); require_once 'modules/AOS_Invoices/AOS_Invoices.php'; require_once 'modules/AOS_Quotes/PDF_Lib/html2pdf.class.php'; require_once 'modules/AOS_Quotes/TemplateParser.php'; require_once 'modules/AOS_PDF_Templates/AOS_PDF_Templates.php'; $invoice = new AOS_Invoices(); $invoice->retrieve($_REQUEST['record']); $lineItems = array(); $sql = "SELECT id, product_id FROM aos_products_quotes WHERE parent_type = 'AOS_Invoices' AND parent_id = '" . $this->bean->id . "' AND deleted = 0"; $res = $invoice->db->query($sql); while ($row = $invoice->db->fetchByAssoc($res)) { $lineItems[$row['id']] = $row['product_id']; } $tempalte = new AOS_PDF_Templates(); $tempalte->retrieve($_REQUEST['templateID']); $object_arr = array(); $object_arr['AOS_Invoices'] = $invoice->id; $search = array('@<script[^>]*?>.*?</script>@si', '@<[\\/\\!]*?[^<>]*?>@si', '@([\\r\\n])[\\s]+@', '@&(quot|#34);@i', '@&(amp|#38);@i', '@&(lt|#60);@i', '@&(gt|#62);@i', '@&(nbsp|#160);@i', '@&(iexcl|#161);@i', '@&(cent|#162);@i', '@&(pound|#163);@i', '@&(copy|#169);@i', '@&#(\\d+);@e', '@<address[^>]*?>@si'); $replace = array('', '', '\\1', '"', '&', '<', '>', ' ', chr(161), chr(162), chr(163), chr(169), 'chr(\\1)', '<br>'); $text = preg_replace($search, $replace, $tempalte->description); $text = str_replace('aos_quotes', 'aos_invoices', $text); $text = str_replace("\$subtotal_amount", "\$aos_invoices_subtotal_amount", $text); $text = str_replace("\$tax_amount", "\$aos_invoices_tax_amount", $text); $text = str_replace("\$shipping_amount", "\$aos_invoices_shipping_amount", $text); $text = str_replace("\$total_amount", "\$aos_invoices_total_amount", $text); //Converting Text