Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/251.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php收入分类报告问题_Php_Math - Fatal编程技术网

php收入分类报告问题

php收入分类报告问题,php,math,Php,Math,我必须创建一份报告,在财政年度内降低会员费 财政年度从7月31日开始 会员期限为1年或2年 我想按比例给会员国打分,以确定他们的会费中有多少属于哪个财政年度 例如,1年的会员资格取决于会员开始的时间,将跨越2个会计年度 即第1财年为365天,第1财年为50天,第二财年为315天。因此,第1年和第2年的总金额分别为(会费/365)x 50 我如何在我的报告中反映这一点 谢谢 编辑: 这是当前成员资格的一个实际示例。财政年度为7月31日 会员1,会费50美元,2009年10月9日收到,第730天,

我必须创建一份报告,在财政年度内降低会员费

财政年度从7月31日开始 会员期限为1年或2年

我想按比例给会员国打分,以确定他们的会费中有多少属于哪个财政年度

例如,1年的会员资格取决于会员开始的时间,将跨越2个会计年度

即第1财年为365天,第1财年为50天,第二财年为315天。因此,第1年和第2年的总金额分别为(会费/365)x 50

我如何在我的报告中反映这一点

谢谢

编辑:

这是当前成员资格的一个实际示例。财政年度为7月31日

会员1,会费50美元,2009年10月9日收到,第730天, 2010财年20.82分、2011财年25.00分、2012财年4.18分, 这里有一个获取下一个发票日期的例程,您可以修改它以获取下两个会计年度结束日期,因为它们总是在同一日期结束,但年份不同

将其与日期差异(如此处的函数)相结合,您应该能够计算每个会计年度剩余的时间。

Jon, 这里有一个获取下一个发票日期的例程,您可以修改它以获取下两个会计年度结束日期,因为它们总是在同一日期结束,但年份不同


将其与日期差异(如此处的函数)相结合,您应该能够计算每个会计年度剩余的时间。

感谢Brian Hoover,他为我提供了正确的信息

我希望将代码展示给其他人,让他们了解如何按比例分配(这很棘手!) 如果您有任何关于使代码更干净的建议,请提供建议。我只是个新手

<?php 

//setup of the dates and values to play with

$now = $row->Membership_Date;
$membership_date = strtotime($now);
$fy2010 = strtotime("2010-07-31");
$fy2011 = strtotime("2011-07-31");
$fy2012 = strtotime("2012-07-31");
$fy2013 = strtotime("2013-07-31");
$fy2014 = strtotime("2014-07-31");

//doing the math to determine time span in unix timecode

$datedifffy2010 = $fy2010 - $membership_date;
$datedifffy2011 = $fy2011 - $membership_date;
$datedifffy2012 = $fy2012 - $membership_date;
$datedifffy2013 = $fy2013 - $membership_date;
$datedifffy2014 = $fy2014 - $membership_date;

//doing the math to transform it into full days

$fulldays2010 = floor($datedifffy2010/(60*60*24));
$fulldays2011 = floor($datedifffy2011/(60*60*24));
$fulldays2012 = floor($datedifffy2012/(60*60*24));
$fulldays2013 = floor($datedifffy2013/(60*60*24));
$fulldays2014 = floor($datedifffy2014/(60*60*24));

//Some values come back as negative, so we are making those zero

if ($fulldays2010 <= 0)
{
    $fulldays2010 = 0;  
};

if ($fulldays2011 <= 0)
{
    $fulldays2011 = 0;  
};

if ($fulldays2012 <= 0)
{
    $fulldays2012 = 0;  
};

if ($fulldays2013 <= 0)
{
    $fulldays2013 = 0;  
};

if ($fulldays2014 <= 0)
{
    $fulldays2014 = 0;  
};

//arithmetic to determine how many days belong to which fiscal year

if ($row->Membership_Length == 2)
{
$fy11remainder = 730 - $fulldays2010;
if ($fy11remainder >= 365) $fy11remainder = 365;
$fy12remainder = 730 - $fy11remainder - $fulldays2010;
if ($fy12remainder >= 365) $fy12remainder = 365;
$fy13remainder = 730 - $fy12remainder - $fy11remainder - $fulldays2010;
if ($fy13remainder >= 365) $fy13remainder = 365;
$fy14remainder = 730 - $fy13remainder - $fy12remainder - $fy11remainder - $fulldays2010;
}
else
{
$fy11remainder = 365 - $fulldays2010;
if ($fy11remainder >= 365) $fy11remainder = 365;
$fy12remainder = 365 - $fy11remainder - $fulldays2010;
if ($fy12remainder >= 365) $fy12remainder = 365;
$fy13remainder = 365 - $fy12remainder - $fy11remainder - $fulldays2010;
if ($fy13remainder >= 365) $fy13remainder = 365;
$fy14remainder = 365 - $fy13remainder - $fy12remainder - $fy11remainder - $fulldays2010;

};

//determining the mill rate for days (our organization has discounts for 2 year memberships, and different types of memberships have different prices

if ($length == 2)
{
    $income = $row->Dues_Paid;
    $daily_income = $income / 730;
}
else
{
    $income = $row->Dues_Paid;
    $daily_income = $income / 365;
};

//Mutiplying days by the mill rate for that specific entry or member

$fy10inc = $fulldays2010 * $daily_income;
$fy11inc = $fy11remainder * $daily_income;
$fy12inc = $fy12remainder * $daily_income;
$fy13inc = $fy13remainder * $daily_income;
$fy14inc = $fy14remainder * $daily_income;

//display pro-rate for fiscal year

echo $fy10inc;


?>

感谢布莱恩·胡佛,他引导我找到了正确的信息

我希望将代码展示给其他人,让他们了解如何按比例分配(这很棘手!) 如果您有任何关于使代码更干净的建议,请提供建议。我只是个新手

<?php 

//setup of the dates and values to play with

$now = $row->Membership_Date;
$membership_date = strtotime($now);
$fy2010 = strtotime("2010-07-31");
$fy2011 = strtotime("2011-07-31");
$fy2012 = strtotime("2012-07-31");
$fy2013 = strtotime("2013-07-31");
$fy2014 = strtotime("2014-07-31");

//doing the math to determine time span in unix timecode

$datedifffy2010 = $fy2010 - $membership_date;
$datedifffy2011 = $fy2011 - $membership_date;
$datedifffy2012 = $fy2012 - $membership_date;
$datedifffy2013 = $fy2013 - $membership_date;
$datedifffy2014 = $fy2014 - $membership_date;

//doing the math to transform it into full days

$fulldays2010 = floor($datedifffy2010/(60*60*24));
$fulldays2011 = floor($datedifffy2011/(60*60*24));
$fulldays2012 = floor($datedifffy2012/(60*60*24));
$fulldays2013 = floor($datedifffy2013/(60*60*24));
$fulldays2014 = floor($datedifffy2014/(60*60*24));

//Some values come back as negative, so we are making those zero

if ($fulldays2010 <= 0)
{
    $fulldays2010 = 0;  
};

if ($fulldays2011 <= 0)
{
    $fulldays2011 = 0;  
};

if ($fulldays2012 <= 0)
{
    $fulldays2012 = 0;  
};

if ($fulldays2013 <= 0)
{
    $fulldays2013 = 0;  
};

if ($fulldays2014 <= 0)
{
    $fulldays2014 = 0;  
};

//arithmetic to determine how many days belong to which fiscal year

if ($row->Membership_Length == 2)
{
$fy11remainder = 730 - $fulldays2010;
if ($fy11remainder >= 365) $fy11remainder = 365;
$fy12remainder = 730 - $fy11remainder - $fulldays2010;
if ($fy12remainder >= 365) $fy12remainder = 365;
$fy13remainder = 730 - $fy12remainder - $fy11remainder - $fulldays2010;
if ($fy13remainder >= 365) $fy13remainder = 365;
$fy14remainder = 730 - $fy13remainder - $fy12remainder - $fy11remainder - $fulldays2010;
}
else
{
$fy11remainder = 365 - $fulldays2010;
if ($fy11remainder >= 365) $fy11remainder = 365;
$fy12remainder = 365 - $fy11remainder - $fulldays2010;
if ($fy12remainder >= 365) $fy12remainder = 365;
$fy13remainder = 365 - $fy12remainder - $fy11remainder - $fulldays2010;
if ($fy13remainder >= 365) $fy13remainder = 365;
$fy14remainder = 365 - $fy13remainder - $fy12remainder - $fy11remainder - $fulldays2010;

};

//determining the mill rate for days (our organization has discounts for 2 year memberships, and different types of memberships have different prices

if ($length == 2)
{
    $income = $row->Dues_Paid;
    $daily_income = $income / 730;
}
else
{
    $income = $row->Dues_Paid;
    $daily_income = $income / 365;
};

//Mutiplying days by the mill rate for that specific entry or member

$fy10inc = $fulldays2010 * $daily_income;
$fy11inc = $fy11remainder * $daily_income;
$fy12inc = $fy12remainder * $daily_income;
$fy13inc = $fy13remainder * $daily_income;
$fy14inc = $fy14remainder * $daily_income;

//display pro-rate for fiscal year

echo $fy10inc;


?>

我所能想到的是,“一列火车从克利夫兰开往俄亥俄州,时速35英里,另一列火车从波士顿开出,时速200英里。在什么情况下,不可避免的爆炸会导致我们所知道的所有社会的毁灭?”嗨,很难理解你的逻辑。。。你的意思是说你按比例收取会费吗?否则,50天的时间从何而来?对安迪来说,是的,会员资格是按比例分配的。我差点忘了word@JonYork,你有计算你需要什么的公式,那么你的问题是什么?考虑到财政年度是7月31日,我只能想,“一列火车从克利夫兰开往俄亥俄州,时速35英里,另一列火车从波士顿开出,时速200英里。在什么情况下,不可避免的爆炸会导致我们所知道的所有社会的毁灭?“嗨,很难理解你的逻辑。。。你的意思是说你按比例收取会费吗?否则,50天的时间从何而来?对安迪来说,是的,会员资格是按比例分配的。我差点忘了word@JonYork,你有计算你需要什么的公式,那么你的问题是什么?考虑到会计年度是7月31日,如何在php中进行计算