'; $hint_ .= '
'; $hint_ .= '
'; $hint_ .= ''; $hint_ .= ''; $hint_ .= '
'; $hint_ .= 'Save  Cancel'; $hint_ .= '
'; $hint_ .= '
'; $hint_ .= ''; $hint = ''.$hint_.''; $hint = ''.$hint_.''; 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); } ?>