95 lines
5.0 KiB
PHP
Executable File
95 lines
5.0 KiB
PHP
Executable File
<?php
|
|
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
|
|
|
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings, $current_user;
|
|
|
|
require_once('modules/EcmPayments/EcmPayment.php');
|
|
require_once('modules/EcmPayments/Forms.php');
|
|
require_once ('include/time.php');
|
|
require_once('include/json_config.php');
|
|
|
|
$json_config = new json_config();
|
|
$focus = new EcmPayment();
|
|
|
|
if(isset($_REQUEST['record']) && $_REQUEST['record'] != '') {
|
|
$focus->retrieve($_REQUEST['record']);
|
|
$focus->format_all_fields();
|
|
}
|
|
if (isset($_REQUEST['parent_id']) && $_REQUEST['parent_id']!='') {
|
|
$a = new Account();
|
|
$a->retrieve($_REQUEST['parent_id']);
|
|
$focus->id=create_guid();
|
|
$focus->parent_id = $a->id;
|
|
$focus->parent_name = $a->name;
|
|
$focus->payment_date = date('d.m.Y');
|
|
global $current_user;
|
|
$focus->assigned_user_id = $current_user->id;
|
|
$focus->assigned_user_name = $current_user->full_name;
|
|
$focus->format_all_fields();
|
|
unset($a);
|
|
}
|
|
|
|
require_once('include/MVC/View/SugarView.php');
|
|
require_once('modules/EcmPayments/view/EditView/view.edit.my.php');
|
|
|
|
$edit = new ViewEditMy();
|
|
$edit->ss = new Sugar_Smarty();
|
|
$edit->module = 'EcmPayments';
|
|
$edit->bean = $focus;
|
|
$edit->tplFile = 'include/EditView/EditViewClassic.tpl';
|
|
/*
|
|
$w=mysql_query("select document_no,register_date,id,total from ecminvoiceouts where deleted='0'");
|
|
$i=0;
|
|
$inv='<table cellspacing="0" cellpadding="0" border="0" width="100%">';
|
|
while($r=mysql_fetch_array($w)){
|
|
//if($i%3==0)
|
|
$inv.='<tr>';
|
|
$inv.='<td><input type="checkbox" name="inv[]" value="'.$r['id'].'"';
|
|
$ww=mysql_query("select id from ecmpayments_ecminvoiceouts where ecminvoiceout_id='".$r['id']."' and ecmpayment_id='".$focus->id."' and deleted='0'");
|
|
if(mysql_num_rows($ww)>0)$inv.=" checked";
|
|
$inv.='> <a href="index.php?module=EcmInvoiceOuts&action=DetailView&record='.$r['id'].'">'.$r['document_no'].'</a> - '.$GLOBALS['timedate']->to_display_date($r['register_date']).' - '.number_format($r['total'],2,",",".").'</td>';
|
|
//if($i%3==2)
|
|
$inv.='</tr>';
|
|
$i++;
|
|
}
|
|
$inv.='</table>';
|
|
$inv.='
|
|
<div id="invoices">
|
|
</div>*/
|
|
/*$inv.='
|
|
|
|
<script language="javascript">
|
|
function openPopupSelect(i){
|
|
return open_popup("EcmInvoiceOuts", 600, 400, "", true, false, {"call_back_function":"set_return","form_name":"EditView","field_to_name_array":{"id":"inv_id"+i,"document_no":"inv_name"+i}}, "single", true);
|
|
}
|
|
function addRow(i){
|
|
document.getElementById(\'inv\'+i).style.display=\'block\';
|
|
document.getElementById(\'inv_no\').value=parseInt(i)+1;
|
|
|
|
}
|
|
</script>';
|
|
$w=mysql_query("select ecminvoiceout_id as iid,ecmpayment_id as pid from ecmpayments_ecminvoiceouts where deleted='0' and ecmpayment_id='".$focus->id."'");
|
|
echo mysql_error();
|
|
$inv.='<input type="hidden" id="inv_no" value="'.mysql_num_rows($w).'"/>
|
|
<input type="button" onclick="addRow(document.getElementById(\'inv_no\').value);" class="button" value="Add"/>
|
|
<div id="invoices">';
|
|
$i=0;
|
|
while($r=mysql_fetch_array($w)){
|
|
$rr=mysql_fetch_array(mysql_query("select document_no from ecminvoiceouts where id='".$r['iid']."' and deleted='0'"));
|
|
if($rr['document_no']){
|
|
$inv.='<div id="inv'.$i.'"><input class="sqsEnabled" name="inv_name'.$i.'" tabindex="" id="inv_name'.$i.'" size="" value="'.$rr['document_no'].'" title="" type="text"><input name="inv_id'.$i.'" id="inv_id'.$i.'" value="'.$r['iid'].'" type="hidden"> <input onclick="openPopupSelect('.$i.');" class="button" type="button" id="select'.$i.'" value="Select" /> <input onclick=document.getElementById("inv'.$i.'").innerHTML=""; class="button" type="button" id="del'.$i.'" value="Delete" /></div>
|
|
<script>
|
|
if(typeof sqs_objects == \'undefined\'){var sqs_objects = new Array;}sqs_objects[\'inv_name'.$i.'\']={"method":"query","modules":["EcmInvoiceOuts"],"group":"or","field_list":["document_no","id"],"populate_list":["inv_name'.$i.'","inv_id'.$i.'"],"conditions":[{"name":"document_no","op":"like_custom","end":"%","value":""}],"required_list":["inv_id'.$i.'"],"order":"document_no","limit":"30","no_match_text":"No Match"};
|
|
</script>';
|
|
$i++;
|
|
}
|
|
}
|
|
$inv.='</div>';
|
|
for($l=$i;$l<100;$l++){
|
|
$inv.='<div id="inv'.$l.'" style="display:none;"><input class="sqsEnabled" name="inv_name'.$l.'" tabindex="" id="inv_name'.$l.'" size="" value="" title="" type="text"><input name="inv_id'.$l.'" id="inv_id'.$l.'" value="" type="hidden"> <input onclick="openPopupSelect('.$l.');" class="button" type="button" id="select'.$l.'" value="Select" /> <input onclick=document.getElementById("inv'.$l.'").innerHTML=""; class="button" type="button" id="del'.$l.'" value="Delete" /></div><script>if(typeof sqs_objects == \'undefined\'){var sqs_objects = new Array;}sqs_objects[\'inv_name'.$l.'\']={"method":"query","modules":["EcmInvoiceOuts"],"group":"or","field_list":["document_no","id"],"populate_list":["inv_name'.$l.'","inv_id'.$i.'"],"conditions":[{"name":"document_no","op":"like_custom","end":"%","value":""}],"required_list":["inv_id'.$l.'"],"order":"document_no","limit":"30","no_match_text":"No Match"};</script>';
|
|
}*/
|
|
echo $focus->parent_name;
|
|
$edit->ss->assign("INVOICES",$inv);
|
|
$edit->preDisplay();
|
|
echo $edit->display();
|
|
?>
|