Files

89 lines
5.1 KiB
PHP
Raw Permalink Normal View History

2025-05-12 15:44:39 +00:00
<?php
function Hint($id,$d){
$guid=create_guid();
$hint_ = '<div class="tabForm" id="hint_div_'.$guid.'" style="border:0px solid black;position:absolute;left:720px;display:none;text-align:center;">';
$hint_ .= '<div align="center" style="width:300px">';
$hint_ .= '<textarea id="desc_'.$id.'" name="desc_'.$id.'" style="width:300px;height:180px;" maxlength="1000">'.$d.'</textarea><br />';
$hint_ .= '<div id="result_'.$id.'" style="display:none;"></div>';
$hint_ .= '<input type="hidden" id="inv_id_'.$id.'" value="'.$id.'" />';
$hint_ .= '<div align="right">';
$hint_ .= '<a href="#" onclick="mintajaxget(\'index.php?to_pdf=1&module=EcmPaymentStates&action=saveDesc&id=\'+document.getElementById(\'inv_id_'.$id.'\').value+\'&desc=\'+document.getElementById(\'desc_'.$id.'\').value,\'desc_'.$id.'\');lock_unlock_Position(\''.$guid.'\',document.getElementById(\'img_'.$guid.'\'));hideCallHint(event,\''.$guid.'\',\''.$id.'\',this);" style="cursor:pointer;">Save</a>&nbsp;&nbsp;<a href="#" onclick="lock_unlock_Position(\''.$guid.'\',document.getElementById(\'img_'.$guid.'\'));hideCallHint(event,\''.$guid.'\',\''.$id.'\',this);" style="cursor:pointer;">Cancel</a>';
$hint_ .= '</div>';
$hint_ .= '</div>';
$hint_ .= '</div>';
$hint = '<span id="'.$guid.'">'.$hint_.'</span><img src="modules/EcmCalls/images/hint_grey.gif">';
$hint = '<span id="'.$guid.'">'.$hint_.'</span><img id="img_'.$guid.'" src="modules/EcmCalls/images/hint_'.((isset($d) && $d != '')?'black':'grey').'.gif" onClick="lock_unlock_Position(\''.$guid.'\',this);" onMouseOver="showCallHint(event,\''.$guid.'\',\''.$id.'\',this,\'Note\');" onMouseOut="hideCallHint(event,\''.$guid.'\',\''.$id.'\',this);">';
return $hint;
}
function getActualSum($account_id){
$w=$GLOBALS['db']->query("select total,register_date from ecmpayments_ecminvoiceouts where paid='0' and register_date>='".date("Y-m-d")."' and account_id='".$account_id."' and deleted='0'");
while($r=$GLOBALS['db']->fetchByAssoc($w))$total+=$r['total'];
return -1*$total;
}
function getSum1($account_id,$d1,$d2=0){
$w=$GLOBALS['db']->query("select total,register_date from ecmpayments_ecminvoiceouts where paid='0' and account_id='".$account_id."' and deleted='0' and register_date>'2008-12-31'");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$e=explode("-",$r['register_date']);
if($d1>0 && $d2>0){
if(mktime(0,0,0,$e[1],$e[2],$e[0])+$d1*24*3600<=mktime(0,0,0,date("m"),date("d"),date("Y")) && mktime(0,0,0,$e[1],$e[2],$e[0])+$d2*24*3600>mktime(0,0,0,date("m"),date("d"),date("Y"))){
$total+=$r['total'];
}
}
elseif($d1>0 && $d2==0){
if(mktime(0,0,0,$e[1],$e[2],$e[0])+$d1*24*3600<=mktime(0,0,0,date("m"),date("d"),date("Y"))){
$total+=$r['total'];
}
}
}
return -1*$total;
}
function getInvoices($account_id,$d1,$d2=0){
$w=$GLOBALS['db']->query("select total,register_date,ecminvoiceout_id,id from ecmpayments_ecminvoiceouts where paid='0' and account_id='".$account_id."' and deleted='0' and register_date>'2008-12-31'");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
$e=explode("-",$r['register_date']);
if($d1>0 && $d2>0){
if(mktime(0,0,0,$e[1],$e[2],$e[0])+$d1*24*3600<=mktime(0,0,0,date("m"),date("d"),date("Y")) && mktime(0,0,0,$e[1],$e[2],$e[0])+$d2*24*3600>mktime(0,0,0,date("m"),date("d"),date("Y"))){
$inv[]=$r['id'];
}
}
elseif($d1>0 && $d2==0){
if(mktime(0,0,0,$e[1],$e[2],$e[0])+$d1*24*3600<=mktime(0,0,0,date("m"),date("d"),date("Y"))){
$inv[]=$r['id'];
}
}
}
return $inv;
}
function getActualInvoices($account_id){
$w=$GLOBALS['db']->query("select total,register_date,ecminvoiceout_id,id from ecmpayments_ecminvoiceouts where paid='0' and register_date>='".date("Y-m-d")."' and account_id='".$account_id."' and deleted='0'");
while($r=$GLOBALS['db']->fetchByAssoc($w))$inv[]=$r['id'];
return $inv;
}
function getSummary($account_id){
$w=$GLOBALS['db']->query("select sum(total) as sum from ecmpayments_ecminvoiceouts where paid='0' and deleted='0' and account_id='".$account_id."' and register_date>'2008-12-31'");
$r=$GLOBALS['db']->fetchByAssoc($w);
$sum_wn=$r['sum'];
//$w=$GLOBALS['db']->query("select sum(value) as sum from ecmpayments where paid='0' and deleted='0' and parent_id='".$account_id."'");
//$r=$GLOBALS['db']->fetchByAssoc($w);
//$sum_ma=$r['sum'];
return ($sum_ma-$sum_wn);
}
function getBallance($account_id){
$w=$GLOBALS['db']->query("select total as sum,paid,register_date from ecmpayments_ecminvoiceouts where deleted='0' and account_id='".$account_id."'");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
if($r['register_date']<'2008-12-31' && $r['paid']==0){}
elseif($r['register_date']<'2008-12-31' && $r['paid']==1)$sum_wn+=$r['sum'];
elseif($r['register_date']>'2008-12-31')$sum_wn+=$r['sum'];
}
$w=$GLOBALS['db']->query("select value as sum,paid,payment_date from ecmpayments where deleted='0' and parent_id='".$account_id."'");
while($r=$GLOBALS['db']->fetchByAssoc($w)){
if($r['payment_date']<'2008-12-31' && $r['paid']==0){}
elseif($r['payment_date']<'2008-12-31' && $r['paid']==1)$sum_ma+=$r['sum'];
elseif($r['payment_date']>'2008-12-31')$sum_ma+=$r['sum'];
}
return ($sum_ma-$sum_wn);
}
?>