Files
2024-04-27 09:23:34 +02:00

66 lines
2.3 KiB
PHP

<?
error_reporting(LC_ALL);
ini_set('display_errors', '1');
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/EcmPrepaymentInvoices/EcmPrepaymentInvoice.php');
//require_once('modules/EcmPrepaymentInvoices/Forms.php');
require_once ('include/time.php');
require_once('include/json_config.php');
$json_config = new json_config();
$focus = new EcmPrepaymentInvoice();
if(isset($_REQUEST['record']))$focus->retrieve($_REQUEST['record']);
$file = 'modules/EcmGroupSales/EcmGroupSale.php';
if(file_exists($file)) {
$cc = array();
require_once($file);
$cc = EcmGroupSale::loadSettings();
}
global $app_list_strings;
require_once('include/MVC/View/SugarView.php');
require_once('modules/EcmPrepaymentInvoices/views/DetailView/view.detail.php');
$detail = new EcmPrepaymentInvoicesViewDetail();
$detail->ss = new Sugar_Smarty();
$detail->module = 'EcmPrepaymentInvoices';
$detail->bean = $focus;
$detail->tplFile = 'include/DetailView/DetailView.tpl';
$btn = '<input name="quote_pdf" id="quote_pdf" title="Show PDF" accessKey="" class="button" onclick="window.open(\'index.php?module=EcmPrepaymentInvoices&action=createPDF&to_pdf=1&record=' . $_REQUEST ['record'] . '\',\'_blank\');" type="button" value="Pokaż PDF"></div>';
$detail->ss->assign ( "CREATE_PDF", $btn );
//get other prepaymentinvoices info
$res = $GLOBALS['db']->query("SELECT id, document_no, inv_value FROM ecmprepaymentinvoices WHERE ecmsale_id='".$focus->ecmsale_id."'");
$total = 0;
$other_inv = '';
while ($row = $GLOBALS['db']->fetchByAssoc($res)) {
if ($row['id']==$focus->id) continue;
$other_inv.='<a href="index.php?module=EcmPrepaymentInvoices&action=DetailView&record='.$row['id'].'">'.$row['document_no'].'</a> ';
$total+=$row['inv_value'];
}
$detail->ss->assign('other_ecmprepaymentinvoices',$other_inv);
$detail->ss->assign('other_ecmprepayment_invoices_sum',format_number($total));
$scriptOpt = '<script language="javascript">
var MOD = '.str_replace('&quot;','\"',$json->encode($mod_strings)).';
var N;
</script>';
echo $scriptOpt;
$detail->preDisplay();
$focus->parent_name_copy = $focus->parent_name;
echo $detail->display();
?>