84 lines
3.0 KiB
PHP
84 lines
3.0 KiB
PHP
|
|
<?
|
||
|
|
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||
|
|
|
||
|
|
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings, $current_user, $app_list_strings;
|
||
|
|
|
||
|
|
require_once('modules/EcmTransactions/EcmTransaction.php');
|
||
|
|
require_once('modules/EcmTransactions/Forms.php');
|
||
|
|
require_once ('include/time.php');
|
||
|
|
require_once('include/json_config.php');
|
||
|
|
|
||
|
|
$json_config = new json_config();
|
||
|
|
//ACLAction::addActions('EcmTransactions', 'EcmTransactions');
|
||
|
|
$focus = new EcmTransaction();
|
||
|
|
|
||
|
|
if(isset($_REQUEST['record']))$focus->retrieve($_REQUEST['record']);
|
||
|
|
|
||
|
|
require_once('include/MVC/View/SugarView.php');
|
||
|
|
|
||
|
|
if(file_exists('modules/EcmTransactions/views/view.detail.php')) {
|
||
|
|
require_once('modules/EcmTransactions/views/view.detail.php');
|
||
|
|
$detail = new EcmTransaction();
|
||
|
|
}
|
||
|
|
else{
|
||
|
|
require_once('include/MVC/View/views/view.detail.php');
|
||
|
|
$detail = new ViewDetail();
|
||
|
|
$detail->ss = new Sugar_Smarty();
|
||
|
|
$detail->module = 'EcmTransactions';
|
||
|
|
}
|
||
|
|
|
||
|
|
global $app_list_strings;
|
||
|
|
|
||
|
|
$db = $GLOBALS['db'];
|
||
|
|
|
||
|
|
//get assigned doc
|
||
|
|
$ff = $db->fetchByAssoc($db->query("SELECT * FROM ecmtransactions WHERE id='".$focus->id."'"));
|
||
|
|
if ($ff['record_id'] && $ff['record_id']!='') {
|
||
|
|
$doc = $db->fetchByAssoc($db->query("SELECT id, document_no FROM ".strtolower($ff['record_type'])." WHERE id ='".$ff['record_id']."'"));
|
||
|
|
$detail->ss->assign('ASSIGNED_DOCUMENT', '<a target="new" href="index.php?module='.$ff['record_type'].'&action=DetailView&record='.$ff['record_id'].'">'.$doc['document_no'].'</a>');
|
||
|
|
}
|
||
|
|
|
||
|
|
$can_edit = true;
|
||
|
|
//get transactions
|
||
|
|
$res = $db->query("
|
||
|
|
select t.id, t.name, rel.value from ecmtransactions_rel as rel
|
||
|
|
inner join ecmtransactions as t
|
||
|
|
on t.id = rel.ecmtransaction_a_id
|
||
|
|
where rel.ecmtransaction_b_id='$focus->id'");
|
||
|
|
$trans = '<table style="width: 40%">';
|
||
|
|
while ($row = $db->fetchByAssoc($res)) {
|
||
|
|
$can_edit = false;
|
||
|
|
$row['value'] = format_number($row['value']);
|
||
|
|
$trans.='<tr style="width: 100%"';
|
||
|
|
$trans.='<td><a target="new" href="index.php?module=EcmTransactions&action=DetailView&record='.$row['id'].'">'.$row['name'].'</a></td>';
|
||
|
|
$trans.='<td style="text-align: right">'.$row['value'].'</td>';
|
||
|
|
$trans.='</tr>';
|
||
|
|
}
|
||
|
|
$res = $db->query("
|
||
|
|
select t.id, t.name, rel.value from ecmtransactions_rel as rel
|
||
|
|
inner join ecmtransactions as t
|
||
|
|
on t.id = rel.ecmtransaction_b_id
|
||
|
|
where rel.ecmtransaction_a_id='$focus->id'");
|
||
|
|
while ($row = $db->fetchByAssoc($res)) {
|
||
|
|
$can_edit = false;
|
||
|
|
$row['value'] = format_number($row['value']);
|
||
|
|
$trans.='<tr style="width: 100%">';
|
||
|
|
$trans.='<td><a target="new" href="index.php?module=EcmTransactions&action=DetailView&record='.$row['id'].'">'.$row['name'].'</a></td>';
|
||
|
|
$trans.='<td style="text-align: right">'.$row['value'].'</td>';
|
||
|
|
$trans.='</tr>';
|
||
|
|
}
|
||
|
|
$trans.='</table>';
|
||
|
|
|
||
|
|
$detail->ss->assign('RELATED_TRANSACTIONS', $trans);
|
||
|
|
$detail->ss->assign('CAN_EDIT', $can_edit);
|
||
|
|
|
||
|
|
$detail->bean = $focus;
|
||
|
|
$detail->preDisplay();
|
||
|
|
|
||
|
|
echo $detail->display();
|
||
|
|
echo '<div id="subpanels_div">';
|
||
|
|
|
||
|
|
require_once('subpanels.php');
|
||
|
|
|
||
|
|
echo '</div>';
|
||
|
|
?>
|