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

139 lines
5.3 KiB
PHP
Executable File

<?
include_once("modules/EcmPaymentStates/helper.php");
global $current_language;
echo '<script type="text/javascript" src="cache/jsLanguage/EcmCalls/'.$current_language.'.js"></script>';
echo '<img id="EcmCalls_image_assign" src="modules/EcmCalls/images/assign_call.gif" style="display:none;" />';
echo '<img id="EcmCalls_image_search" src="modules/EcmCalls/images/search_call.gif" style="display:none;" />';
echo '<script type="text/javascript" src="include/JSON.js"></script>';
echo '<script type="text/javascript" src="modules/EcmCalls/Hint.js"></script>';
echo '<script language="javascript" src="modules/EcmCalls/DoCall.js"></script>';
echo '<script language="javascript" src="modules/EcmCalls/ListView.js"></script>';
echo '<link rel="stylesheet" type="text/css" href="modules/EcmCalls/Hint.css" />';
$w=$GLOBALS['db']->query("select distinct name from accounts where id='".$_REQUEST['account_id']."'");
$r=$GLOBALS['db']->fetchByAssoc($w);
$aname=$r['name'];
if($_REQUEST['actual_sum']!=1)$title=$aname." - ".$_REQUEST['start']." - ".$_REQUEST['end'];
else $title=$aname." - Not overdue";
?>
<table cellspacing="0" cellpadding="0" border="0"><tr><td></td><td><h2>Payments States: Summary - <?php echo $title;?></h2></td></tr></table>
<br />
<input type="button" class="button" value="Create XLS" name="create_xls" onclick="location.href='index.php?module=EcmPaymentStates&action=CreateXLSsummary_inv&to_pdf=1&account_id=<?php echo $_REQUEST['account_id'];?>&start=<?php echo $_REQUEST['start'];?>&end=<?php echo $_REQUEST['end'];?>';" />
<?php
if($_REQUEST['end']=="...")$_REQUEST['end']=0;
if($_REQUEST['actual_sum']==1)$inv=getActualInvoices($_REQUEST['account_id']);
else $inv=getInvoices($_REQUEST['account_id'],$_REQUEST['start'],$_REQUEST['end']);
if (!is_array($inv)) return;
foreach($inv as $in){
$invs[]="p.id='".$in."'";
}
$tds1='<td class="listViewThS1">';
$trs='<tr>';
$tre='</tr>';
$tds='<td class="oddListRowS1">';
$tde='</td>';
$tbs='<table cellpadding="0" cellspacing="0" border="0" class="ListView" style="width:100%;">';
$tbe='</table>';
echo '
<script language="javascript" src="modules/EcmProducts/helper.js"></script>
<script language="javascript">
function showDiv(obj,value,inv_id){
var div=document.getElementById("div_desc");
document.getElementById("desc").value="";
document.getElementById("desc").value=document.getElementById("desc"+inv_id).value;
document.getElementById("inv_id").value=inv_id;
div.style.display="";
var x=findPosX(obj)-180;
var y=findPosY(obj);
moveDiv(div,y,(x+10));
}
</script>';
echo '<div id="div_desc" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;text-align:center;position:absolute;display:none;">';
echo '<textarea id="desc1" name="desc1" style="display:none;"></textarea><br />';
echo '<textarea id="desc" name="desc"></textarea><br />';
echo '<div id="result" style="display:none;"></div>';
echo '<input type="hidden" id="inv_id" />';
echo '<input type="button" class="button" value="Save" onclick="mintajaxget(\'index.php?to_pdf=1&module=EcmPaymentStates&action=saveDesc&id=\'+document.getElementById(\'inv_id\').value+\'&desc=\'+document.getElementById(\'desc\').value,\'desc\'+document.getElementById(\'inv_id\').value);document.getElementById(\'div_desc\').style.display=\'none\';" />&nbsp;';
echo '<input type="button" class="button" value="Close" onclick="document.getElementById(\'div_desc\').style.display=\'none\';" />';
echo '</div>';
$t.=$tbs;
$t.=$trs;
$t.=$tds1;
$t.="Number";
$t.=$tde;
$t.=$tds1;
$t.="Type";
$t.=$tde;
$t.=$tds1;
$t.="Name";
$t.=$tde;
$t.=$tds1;
$t.="To";
$t.=$tde;
$t.=$tds1;
$t.="Total";
$t.=$tde;
$t.=$tds1;
$t.="Document Date";
$t.=$tde;
$t.=$tds1;
$t.="User";
$t.=$tde;
$t.=$tds1;
$t.='&nbsp;';
$t.=$tde;
$t.=$tre;
$z="select p.total,p.document_no,p.register_date,p.ecminvoiceout_id from ecmpayments_ecminvoiceouts as p where p.deleted='0' and (".implode(" or ",$invs).") order by p.register_date desc";
$w=$GLOBALS['db']->query($z);
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$rr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select id,register_date,parent_name,parent_id, type from ecminvoiceouts where document_no='".$r['document_no']."' and deleted='0' and canceled='0'"));
if(!$rr['register_date'])$rr['register_date']=$r['register_date'];
$rrr=$GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select user_name from users where id='".$rr['assigned_user_id']."'"));
$user=$rrr['user_name'];
if($rr['type']=="correct")$type="Correct";
else $type="Normal";
if(!$rr['name'])$name="blank";
else $name=$rr['name'];
$t.=$trs;
$t.=$tds;
$t.='<a href="index.php?action=DetailView&module=EcmInvoiceOuts&record='.$rr['id'].'">'.$r['document_no'].'</a>';
$t.=$tde;
$t.=$tds;
$t.=$type;
$t.=$tde;
$t.=$tds;
$t.='<a href="index.php?action=DetailView&module=EcmInvoiceOuts&record='.$rr['id'].'">'.$name.'</a>';
$t.=$tde;
$t.=$tds;
$t.='<a href="index.php?action=DetailView&module=Accounts&record='.$rr['parent_id'].'">'.$rr['parent_name'].'</a>';
$t.=$tde;
$t.=$tds;
$t.=number_format($r['total'],2,",",".");
$t.=$tde;
$t.=$tds;
$t.=$GLOBALS['timedate']->to_display_date($rr['register_date']);
$t.=$tde;
$t.=$tds;
$t.=$user;
$t.=$tde;
$t.=$tds;
$t.=Hint($r['ecminvoiceout_id'],$rinv['description']);
$t.=$tde;
$t.=$tre;
$i++;
}
$t.=$tbe;
echo $t;
?>