From a63aa9c6fb00730975c910a7d6bee0c0fb1f8ddc Mon Sep 17 00:00:00 2001 From: lwms Date: Fri, 10 May 2002 02:11:12 +0000 Subject: *** empty log message *** git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@156 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/cal.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mbbsd/cal.c b/mbbsd/cal.c index 1e939641..69bab70e 100644 --- a/mbbsd/cal.c +++ b/mbbsd/cal.c @@ -1,4 +1,4 @@ -/* $Id: cal.c,v 1.8 2002/05/06 09:17:02 lwms Exp $ */ +/* $Id: cal.c,v 1.9 2002/05/10 02:11:12 lwms Exp $ */ #include #include #include @@ -370,11 +370,13 @@ int give_tax(int money) { int i, tax = 0; static int tax_bound[] = { 1000000, 100000, 10000, 1000, 0}; - static double tax_rate[] = { 0.4, 0.3, 0.2, 0.1, 0.05 }; - for( i = 0; money < tax_bound[i]; i++ ) - ; - tax = money * tax_rate[i]; - return tax <= 0 ? 1 : tax; + static double tax_rate[] = { 0.4, 0.3, 0.2, 0.1, 0.08 }; + for( i = 0; i <= 4 ; i++ ) + if ( money > tax_bound[i] ) { + tax += (money - tax_bound[i]) * tax_rate[i]; + money -= (money - tax_bound[i]); + } + return (tax <= 0) ? 1 : tax; } int p_give() { @@ -394,6 +396,7 @@ int p_give() { if ( money - tax <= 0 ) return 0; /* 繳完稅就沒錢給了 */ deumoney(searchuser(id), money - tax); demoney(-(money - tax )); + vice(tax, "贈與稅"); now = time(NULL); sprintf(genbuf,"%s\t給%s\t%d\t%s", cuser.userid, id, money - tax, ctime(&now)); @@ -401,7 +404,6 @@ int p_give() { genbuf[0] = 'n'; getdata(3, 0, "要自行書寫紅包袋嗎?[y/N]", genbuf, 2, LCECHO); mail_redenvelop(cuser.userid, id, money - tax, genbuf[0]); - vice(tax, "贈與稅"); } return 0; } -- cgit v1.2.3