Esempio n. 1
0
    die('Error retrieving record. This record may be deleted or you may not be authorized to view it.');
}
require_once 'modules/AOS_Quotes/AOS_Quotes.php';
require_once 'modules/AOS_Quotes/TemplateParser.php';
require_once 'modules/AOS_PDF_Templates/AOS_PDF_Templates.php';
global $current_user;
$quote = new AOS_Quotes();
$quote->retrieve($_REQUEST['record']);
$lineItems = array();
$sql = "SELECT id, product_id FROM aos_products_quotes WHERE parent_type = 'AOS_Quotes' AND parent_id = '" . $this->bean->id . "' AND deleted = 0";
$res = $quote->db->query($sql);
while ($row = $quote->db->fetchByAssoc($res)) {
    $lineItems[$row['id']] = $row['product_id'];
}
$template = new AOS_PDF_Templates();
$template->retrieve($quote->template_ddown_c);
$object_arr = array();
$object_arr['AOS_Quotes'] = $quote->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, $template->description);
$text = str_replace("\$subtotal_amount", "\$aos_quotes_subtotal_amount", $text);
$text = str_replace("\$tax_amount", "\$aos_quotes_tax_amount", $text);
$text = str_replace("\$shipping_amount", "\$aos_quotes_shipping_amount", $text);
$text = str_replace("\$total_amount", "\$aos_quotes_total_amount", $text);
//Converting Text
$parts = explode('$aos_products_quotes_name', $text);
$text = $parts[0];
$parts = explode('$aos_products_quotes_product_total_price', $parts[1]);
$linePart = '$aos_products_quotes_name' . $parts[0] . '$aos_products_quotes_product_total_price';
//Converting Line Items
Esempio n. 2
0
}
$contract_condition = array();
$sql1 = "SELECT * FROM contract_conditions WHERE contract_condition_id ='" . $module->id . "' AND deleted = 0";
$res1 = $module->db->query($sql1);
while ($row1 = $module->db->fetchByAssoc($res1)) {
    $contract_condition[$row1['id']] = $row1['contract_condition_id'];
}
$transport_contract = array();
$sql2 = "SELECT * FROM transportcontracts WHERE contract_id='" . $this->id . "' AND deleted =0";
$res2 = $module->db->query($sql2);
while ($row2 = $module->db->fetchByAssoc($res2)) {
    $transport_contract[$row2['id']] = $row2['contract_id'];
}
$doc->setFontFamily("Time New Roman");
$template = new AOS_PDF_Templates();
$template->retrieve($_REQUEST['templateID']);
$object_arr = array();
$object_arr[$module_type] = $module->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', '@&#(\\d+);@e', '@<address[^>]*?>@si');
$replace = array('', '', '\\1', '"', '&', '<', '>', ' ', chr(161), 'chr(\\1)', '<br>');
$header = preg_replace($search, $replace, $template->pdfheader);
$footer = preg_replace($search, $replace, $template->pdffooter);
$text = preg_replace($search, $replace, $template->description);
$text = preg_replace('/\\{DATE\\s+(.*?)\\}/e', "date('\\1')", $text);
$printable = str_replace("\r\n", "<br />", $text);
global $sugar_config;
$firstValue = '';
$firstNum = 0;
$lastValue = '';
$lastNum = 0;
$contract_value = new ContractValue();
require_once 'modules/AOS_PDF_Templates/PDF_Lib/mpdf.php';
require_once 'modules/AOS_PDF_Templates/templateParser.php';
require_once 'modules/AOS_PDF_Templates/sendEmail.php';
require_once 'modules/AOS_PDF_Templates/AOS_PDF_Templates.php';
global $mod_strings;
$module = new Contract();
$module_type = $_REQUEST['module'];
$module_type_file = strtoupper(ltrim(rtrim($module_type, 's'), ''));
$module_type_low = strtolower($module_type);
$module->retrieve($_REQUEST['contractid']);
$task = $_REQUEST['task'];
$doc = new clsMsDocGenerator();
$doc->setFontFamily("Time New Roman");
$template = new AOS_PDF_Templates();
//    $template->retrieve($_REQUEST['templateID']);
$template->retrieve('202b6fea-2574-6b18-d0b2-4e7c9f5ef960');
$object_arr = array();
$object_arr[$module_type] = $module->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', '@&#(\\d+);@e', '@<address[^>]*?>@si');
$replace = array('', '', '\\1', '"', '&', '<', '>', ' ', chr(161), 'chr(\\1)', '<br>');
$header = preg_replace($search, $replace, $template->pdfheader);
$footer = preg_replace($search, $replace, $template->pdffooter);
$text = preg_replace($search, $replace, $template->description);
$text = preg_replace('/\\{DATE\\s+(.*?)\\}/e', "date('\\1')", $text);
$text = str_replace("\$contracts", "\$" . $module_type_low, $text);
$text = str_replace("\$travelguide_name", "Bui cao Học", $text);
$printable = str_replace("\n", "<br />", $text);
$converted = templateParser::parse_template($text, $object_arr);
$header = templateParser::parse_template($header, $object_arr);
$footer = templateParser::parse_template($footer, $object_arr);
$printable = str_replace("\n", "<br />", $converted);