summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorlwms <lwms@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-05-10 10:11:12 +0800
committerlwms <lwms@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-05-10 10:11:12 +0800
commita63aa9c6fb00730975c910a7d6bee0c0fb1f8ddc (patch)
treef176825eebb7e32f94186319229031ea99988f07 /mbbsd
parent65da8e2380a6bc4b21bdea6bc39fba8aa96442b2 (diff)
downloadpttbbs-a63aa9c6fb00730975c910a7d6bee0c0fb1f8ddc.tar
pttbbs-a63aa9c6fb00730975c910a7d6bee0c0fb1f8ddc.tar.gz
pttbbs-a63aa9c6fb00730975c910a7d6bee0c0fb1f8ddc.tar.bz2
pttbbs-a63aa9c6fb00730975c910a7d6bee0c0fb1f8ddc.tar.lz
pttbbs-a63aa9c6fb00730975c910a7d6bee0c0fb1f8ddc.tar.xz
pttbbs-a63aa9c6fb00730975c910a7d6bee0c0fb1f8ddc.tar.zst
pttbbs-a63aa9c6fb00730975c910a7d6bee0c0fb1f8ddc.zip
*** empty log message ***
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@156 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/cal.c16
1 files 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -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;
}