Files
2025-05-12 15:44:39 +00:00

82 lines
2.6 KiB
PHP
Executable File

<?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();
}
$OPT = array();
$OPT['row_item_height'] = $cc['row_item_height'];
$OPT['row_item_height_selected'] = $cc['row_item_height_selected'];
$OPT['rows_on_item_list'] = $cc['rows_on_item_list'];
$OPT['position_table_height'] = $OPT['row_item_height']*$OPT['rows_on_item_list']+40+$OPT['rows_on_item_list']*4;
$OPT['quick_product_item_adding'] = $cc['quick_product_item_adding'];
global $app_list_strings;
$focus->position_list = str_replace('&quot;','\"',$focus->getPositionListDetailView());
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';
$detail->ss->assign("POSITION_LIST", $focus->position_list);
//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',$total);
$scriptOpt = '<script language="javascript">
var OPT = '.str_replace('&quot;','\"',$json->encode($OPT)).';
var MOD = '.str_replace('&quot;','\"',$json->encode($mod_strings)).';
var N;
</script>';
echo $scriptOpt;
$detail->preDisplay();
echo $detail->display();
?>