问题描述
您好,
我在jquery中有一个表,其中日期为日期选择器的日期和旁边的一个名为Hours的列。我需要一起使用这些来输入特定日期的小时数。现在,我有一个隐藏的字段变量,另一个日期叫做paystartdate。每个付费周都从这个paystartdate开始。此paystartdate和paystartdate + 6周的小时数不应超过40小时。当我尝试将付费周的小时列相加时,它会添加所有行。但我需要总结一周。怎么做。
简单来说,我需要根据该付费周的报告日期,将每周的时间总和相加。
Hello,
I have a table in jquery which has daydate as date from date picker and a column next to that called Hours. I need to use these together to enter hours for that specific date. Now, I've a hidden field variable with another date called paystartdate. Every payweek starts from this paystartdate. And the sum of hours for this paystartdate and paystartdate+6 week shouldn't be more than 40 hrs. When I try to sum the hours column for the payweek it is adding all the rows. But I need to sum up for each week. How to do this.
In simple words I need to sum the hours coloumn for each week on basis of report dates for that payweek.
var _paystartdate = new Date($('[id$=hdnpaystartdate]').val());
var daydate = new $('[id$=datepicker]').val();
var _payenddate = new Date(_paystartdate);
_payenddate.setDate(_paystartdate.getDate() + 6);
if(Date.parse(daydate)> = _paystartdate&& Date.parse(daydate)< = _payenddate)
本周的小时数总和。当我这样做时,我得到整列的总和
推荐答案
这篇关于如何使用javascript或jquery将列的值汇总到特定位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!