コード例 #1
0
 function display()
 {
     $focus = new Insurances();
     $ss = new Sugar_Smarty();
     $db = DBManagerFactory::getInstance();
     // ONLY LOAD A RECORD IF A RECORD ID IS GIVEN;
     // A RECORD ID IS NOT GIVEN WHEN VIEWING IN LAYOUT EDITOR
     $record = isset($_GET["record"]) ? htmlspecialchars($_GET["record"]) : '';
     $template = file_get_contents('modules/Insurances/tpls/export.tpl');
     $name = "";
     $start = "";
     $end = "";
     $canhan = "";
     $giadinh = "";
     $canhan = $focus->get_data_insurances_canhan($record, $name, $start, $end);
     $giadinh = $focus->get_data_insurances_giadinh($record, $name, $start, $end);
     $template = str_replace("{CANHAN}", $canhan, $template);
     $template = str_replace("{GIADINH}", $giadinh, $template);
     $template = str_replace("{TITLE}", $name, $template);
     $template = str_replace("{NGAYBATDAU}", $start, $template);
     $template = str_replace("{NGAYKETTHUC}", $end, $template);
     $size = strlen($template);
     $filename = strtoupper($name) . ".doc";
     ob_end_clean();
     header("Cache-Control: private");
     header("Content-Type: application/force-download;");
     header("Content-Disposition:attachment; filename=\"{$filename}\"");
     header("Content-length:{$size}");
     echo $template;
     ob_flush();
 }
コード例 #2
0
 function display()
 {
     global $sugar_config;
     $focus = new Insurances();
     $ss = new Sugar_Smarty();
     $db = DBManagerFactory::getInstance();
     // ONLY LOAD A RECORD IF A RECORD ID IS GIVEN;
     // A RECORD ID IS NOT GIVEN WHEN VIEWING IN LAYOUT EDITOR
     $record = isset($_GET["record"]) ? htmlspecialchars($_GET["record"]) : '';
     $template = file_get_contents('modules/Insurances/tpls/Export.tpl');
     $sql = "SELECT\r\n                g.groupprogram_code\r\n                ,g.tour_name\r\n                ,g.end_date_group\r\n                ,g.start_date_group\r\n                ,gg.grouplists87eduplists_ida\r\n                FROM\r\n                  groupprograms g INNER JOIN groupprogras_insurances_c gi ON g.id = gi.groupprogr3b48rograms_ida INNER JOIN insurances ins \r\n                  ON ins.id = gi.groupprogr5003urances_idb\r\n                  INNER JOIN grouplists_roupprograms_c gg ON g.id = gg.grouplistsf242rograms_idb   WHERE g.deleted = 0 AND gi.deleted = 0 AND gi.groupprogr5003urances_idb ='" . $record . "'";
     $result = $db->query($sql);
     $row = $db->fetchByAssoc($result);
     $template = str_replace("{TOURNAME}", $row['tour_name'], $template);
     $template = str_replace("{SITE_URL}", $sugar_config['site_url'], $template);
     $template = str_replace("{CODE}", $row['groupprogram_code'], $template);
     $template = str_replace("{START_DATE}", $row['start_date_group'], $template);
     $template = str_replace("{END_DATE}", $row['end_date_group'], $template);
     $template = str_replace("{SOLUONG}", $focus->get_count($record), $template);
     $template = str_replace("{TEL}", '', $template);
     $template = str_replace("{FAX}", '', $template);
     $template = str_replace("{LIST_FIT}", $focus->get_fit_to_export($record), $template);
     $template = str_replace("{DATE}", date('d/m/Y'), $template);
     $size = strlen($template);
     $filename = "DS bao Hiem " . $row['tour_name'] . ".doc";
     ob_end_clean();
     header("Cache-Control: private");
     header("Content-Type: application/force-download;");
     header("Content-Disposition:attachment; filename=\"{$filename}\"");
     header("Content-length:{$size}");
     echo $template;
     ob_flush();
 }
コード例 #3
0
<?php

include dirname(__FILE__) . '/../../bootstrap/Doctrine.php';
$t = new lime_test(1, new lime_output_color());
$lastIg = Doctrine::getTable('igs')->findOneByIgNum('21Ter');
$insurances = new Insurances();
$insurances->setInsuranceValue(750);
$insurances->setInsuranceCurrency('€');
$insurances->setReferencedRelation('igs');
$insurances->setRecordId($lastIg->getId());
$insurances->save();
$insurances = Doctrine::getTable('insurances')->findForTable('igs', $lastIg->getId());
$t->is($insurances[0]->getFormatedInsuranceValue(), '750.00 €', 'Insurance value is well "750.00 €"');
コード例 #4
0
 public function duplicate($id)
 {
     // reembed duplicated comment
     $Comments = Doctrine::getTable('Comments')->findForTable('loans', $id);
     foreach ($Comments as $key => $val) {
         $comment = new Comments();
         $comment->fromArray($val->toArray());
         $form = new CommentsSubForm($comment);
         $this->attachEmbedRecord('Comments', $form, $key);
     }
     // reembed duplicated insurances
     $Insurances = Doctrine::getTable('Insurances')->findForTable('loans', $id);
     foreach ($Insurances as $key => $val) {
         $insurance = new Insurances();
         $insurance->fromArray($val->toArray());
         $form = new InsurancesSubForm($insurance);
         $this->attachEmbedRecord('Insurances', $form, $key);
     }
 }