dedecms本地调试好的网站怎么上传到服务器音乐网站开发思路
dedecms本地调试好的网站怎么上传到服务器,音乐网站开发思路,关于网站开发的引言,网络营销推广的目的是题目
我看了一下#xff0c;这个题目应该不是什么机密#xff0c;所以先放上来了。大概意思是根据合同信息生成交租阶段信息。 解答
要求是要使用 Ruby 生成交租阶段信息#xff0c;由于时间比较仓促#xff0c;变量名那些就用得随意了些。要点主要有下面这些#xff1a…题目
我看了一下这个题目应该不是什么机密所以先放上来了。大概意思是根据合同信息生成交租阶段信息。 解答
要求是要使用 Ruby 生成交租阶段信息由于时间比较仓促变量名那些就用得随意了些。要点主要有下面这些
第一个交费阶段是要单独算整月和非整月的计算方式是不一样的同样的整月不同月的天数不一样但是租金还是要算成一样的我目前是把合同起始结束月都当做非整月来算循环结束时间判断其实也就是缴费阶段结束日期和合同的结束日期进行对比判断
require time
require terminal-tableclass Rentdef initialize(contract_start, contract_end, month_rent, cycle)contract_start Time.strptime(contract_start, %Y-%m-%d).to_datecontract_end Time.strptime(contract_end, %Y-%m-%d).to_datemonth_rent month_rentcycle cycleyear_total_rent 12 * month_rent.to_ftb Terminal::Table.newenddef generate_next_month_last_day(time)date Date.new(time.year, time.month, time.day)date date.next_monthDate.civil(date.year, date.month, -1)enddef calculate_first_month_rent(time)month_last_day Date.civil(time.year, time.month, -1)month_day_left month_last_day.day - time.day 1year_total_rent * month_day_left / 365enddef calculate_last_month_rent(time)year_total_rent * time.day / 365enddef add_rows# 合同起始和结束日期当月都按非整月计算其他整月按整月的租金计算rent_day contract_starttotal calculate_first_month_rent(contract_start)to_end falsetmp_cycle cycle - 1next_month_last_day rent_dayif tmp_cycle 0 # 一月一租next_month_last_day Date.civil(next_month_last_day.year, next_month_last_day.month, -1)enduntil tmp_cycle 0next_month_last_day generate_next_month_last_day(next_month_last_day)if next_month_last_day contract_endtotal calculate_last_month_rent(contract_end)next_month_last_day contract_endto_end truebreakendtotal month_renttmp_cycle - 1endstart_date rent_dayend_date next_month_last_daytb.add_row([start_date, end_date, rent_day, %.2f % total])total 0until to_endtmp_cycle cyclerent_day Date.new(next_month_last_day.year, next_month_last_day.month, 15)start_date next_month_last_day 1until tmp_cycle 0next_month_last_day generate_next_month_last_day(next_month_last_day)if next_month_last_day contract_endtotal calculate_last_month_rent(contract_end)next_month_last_day contract_endto_end truebreakendtotal month_renttmp_cycle - 1endend_date next_month_last_daytb.add_row([start_date, end_date, rent_day, %.2f % total])total 0endenddef show_tableset_table_titleset_table_headingsadd_rowsprint_tableenddef set_table_titletb.title 交租阶段信息enddef set_table_headingstb.headings [开始日期, 结束日期, 交租日期, 交租阶段总租金]enddef set_align_columntb.number_of_columns.times do |index|tb.align_column(index 1, :right)endtb.align_column(0, :left)enddef print_tableputs tbputsend
endrent Rent.new(2020-11-16, 2021-03-16, 5000, 2)
rent.show_table
----------------------------------------------------
| 交租阶段信息 |
----------------------------------------------------
| 开始日期 | 结束日期 | 交租日期 | 交租阶段总租金 |
----------------------------------------------------
| 2020-11-16 | 2020-12-31 | 2020-11-16 | 7465.75 |
| 2021-01-01 | 2021-02-28 | 2020-12-15 | 10000.00 |
| 2021-03-01 | 2021-03-16 | 2021-02-15 | 2630.14 |
----------------------------------------------------
目前按照一月一交的话交租日期那块显示还有点问题这个后面再优化吧。
----------------------------------------------------
| 交租阶段信息 |
----------------------------------------------------
| 开始日期 | 结束日期 | 交租日期 | 交租阶段总租金 |
----------------------------------------------------
| 2020-11-16 | 2020-11-30 | 2020-11-16 | 2465.75 |
| 2020-12-01 | 2020-12-31 | 2020-11-15 | 5000.00 |
| 2021-01-01 | 2021-01-31 | 2020-12-15 | 5000.00 |
| 2021-02-01 | 2021-02-28 | 2021-01-15 | 5000.00 |
| 2021-03-01 | 2021-03-16 | 2021-02-15 | 2630.14 |
----------------------------------------------------
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/89147.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!