DATE 查找表 (1990/01/01:2041/12/31) [英] DATE lookup table (1990/01/01:2041/12/31)

查看:29
本文介绍了DATE 查找表 (1990/01/01:2041/12/31)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 DATE 的主表来查找日期和其他值,以便在我的应用程序中控制多个事件、间隔和计算.从 1990 年 1 月 1 日到 2041 年 12 月 31 日,它每天都有行.

I use a DATE's master table for looking up dates and other values in order to control several events, intervals and calculations within my app. It has rows for every single day begining from 01/01/1990 to 12/31/2041.

我如何使用这个查找表的一个例子是:

One example of how I use this lookup table is:

  1. 一位客户在 2010 年 1 月 31 日典当了一件物品
  2. 客户于 2010 年 5 月 3 日返回以支付利息以避免没收该商品.
  3. 如果他支付 1 个月的利息,员工输入1",应用程序会查找典当
    日期主表中的日期(JAN-31-2010),并将 FEB-28-2010 置于适用的利益中pymt 日期.FEB-28 被退回,因为 FEB-31 不存在!如果 2010 年是闰年,会在 2 月 29 日返回.
  4. 如果客户付款 2 个月,则退回 MAR-31-2010.3 个月,APR-30... 如果客户支付超过 3 个月或日期查询表未涵盖的其他期间,员工手动输入适用日期.

日期查找表如下所示:

{ Copyright 1990:2010, Frank Computer, Inc. }

{ DBDATE=YMD4- (correctly sorted for faster lookup) }

CREATE TABLE     datemast 
(
 dm_lookup       DATE,    {lookup col used for obtaining values below}
 dm_workday      CHAR(2), {NULL=Normal Working Date,}
                          {NW=National Holiday(Working Date),}
                          {NN=National Holiday(Non-Working Date),}
                          {NH=National Holiday(Half-Day Working Date),}
                          {CN=Company Proclamated(Non-Working Date),}
                          {CH=Company Proclamated(Half-Day Working Date)}

 {several other columns omitted}

 dm_description CHAR(30), {NULL, holiday description or any comments}
 dm_day_num     SMALLINT, {number of elapsed days since begining of year}
 dm_days_left   SMALLINT, (number of remaining days until end of year}

 dm_plus1_mth   DATE,     {plus 1 month from lookup date}
 dm_plus2_mth   DATE,     {plus 2 months from lookup date}
 dm_plus3_mth   DATE,     {plus 3 months from lookup date}
 dm_fy_begins   DATE,     {fiscal year begins on for lookup date}
 dm_fy_ends     DATE,     {fiscal year ends on for lookup date}
 dm_qtr_begins  DATE,     {quarter begins on for lookup date}
 dm_qtr_ends    DATE,     {quarter ends on for lookup date}
 dm_mth_begins  DATE,     {month begins on for lookup date}
 dm_mth_ends    DATE,     {month ends on for lookup date}
 dm_wk_begins   DATE,     {week begins on for lookup date}
 dm_wk_ends     DATE,     {week ends on for lookup date}

 {several other columns omitted}
)
IN "S:PAWNSHOP.DBSDATEMAST"; 

有没有更好的方法或者是一个很酷的方法?

Is there a better way of doing this or is it a cool method?

推荐答案

好的,所以我测试了我的应用程序使用 31 天/月来计算利率和当铺对此很满意!当地法律祈祷如下:从典当或最后一个整数.皮姆特日期到 5 天,5% 的本金利息,6 到 10 天 = 10%,11 到 15 天 = 15%,16 天到 1 个月" = 20%.

OK, so I tested my app using 31 days/month to calculate interest rates & pawnshops are happy with it! Local Law prays as follows: From pawn or last int. pymt. date to 5 elapsed days, 5% interest on principal, 6 to 10 days = 10%, 11 to 15 days = 15%, and 16 days to 1 "month" = 20%.

所以现在兴趣表定义如下:

So the interest table is now defined as follows:

NUMBER OF ELAPSED DAYS SINCE
PAWN DATE OR LAST INTEREST PYMT

 FROM     TO  ACUMULATED
  DAY    DAY    INTEREST
-----   ----  ----------
    0      5       5.00%
    6     10      10.00%
   11     15      15.00%
   16     31      20.00%
   32     36      25.00%
   37     41      30.00%
   42     46      35.00%
   47     62      40.00%

   [... until day 90 (forfeiture allowed)]
   from day 91 to 999, daily prorate based on 20%/month.

在 3 月 13 日或 1752 年 9 月在英国发生了不好的事情吗?

Did something bad happen in the UK on MAR-13 or SEP-1752?

这篇关于DATE 查找表 (1990/01/01:2041/12/31)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆