summaryrefslogtreecommitdiffstats
path: root/mbbsd/cal.c
diff options
context:
space:
mode:
authorlwms <lwms@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-05-02 14:20:40 +0800
committerlwms <lwms@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-05-02 14:20:40 +0800
commitcc31f6faeba08fbc6769f6d0c6fb21be10f364de (patch)
tree5bfed0651e32a25c6d51027d50129137d5e19409 /mbbsd/cal.c
parent1ff60e643a2e1d2f8f1274fc0fe6d76d5a607ee5 (diff)
downloadpttbbs-cc31f6faeba08fbc6769f6d0c6fb21be10f364de.tar
pttbbs-cc31f6faeba08fbc6769f6d0c6fb21be10f364de.tar.gz
pttbbs-cc31f6faeba08fbc6769f6d0c6fb21be10f364de.tar.bz2
pttbbs-cc31f6faeba08fbc6769f6d0c6fb21be10f364de.tar.lz
pttbbs-cc31f6faeba08fbc6769f6d0c6fb21be10f364de.tar.xz
pttbbs-cc31f6faeba08fbc6769f6d0c6fb21be10f364de.tar.zst
pttbbs-cc31f6faeba08fbc6769f6d0c6fb21be10f364de.zip
*** empty log message ***
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@139 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/cal.c')
-rw-r--r--mbbsd/cal.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/mbbsd/cal.c b/mbbsd/cal.c
index 6603925e..a5526783 100644
--- a/mbbsd/cal.c
+++ b/mbbsd/cal.c
@@ -1,4 +1,4 @@
-/* $Id: cal.c,v 1.2 2002/04/28 19:35:28 in2 Exp $ */
+/* $Id: cal.c,v 1.3 2002/05/02 06:20:40 lwms Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -365,8 +365,19 @@ void mail_redenvelop(char* from, char* to, int money, char mode){
append_record(genbuf, &fhdr, sizeof(fhdr));
}
+/* 計算贈與稅 */
+int give_tax(int money)
+{
+ int tax = 0, tax_rate;
+ static int tax_bound[] = { 1000000, 100000, 10000, 1000 };
+ for( tax_rate = 0; tax_rate <= 3; tax_rate++ )
+ if ( money >= tax_bound[tax_rate] ) break;
+ tax = money * ( 0.5 - tax_rate/10.0 );
+ return tax;
+}
+
int p_give() {
- int money;
+ int money, tax;
char id[IDLEN + 1], genbuf[90];
time_t now = time(0);
@@ -378,7 +389,8 @@ int p_give() {
money = atoi(genbuf);
reload_money();
if(money > 0 && cuser.money >= money ) {
- deumoney(searchuser(id), money);
+ tax = give_tax(money);
+ deumoney(searchuser(id), money - tax);
demoney(-money);
now = time(NULL);
sprintf(genbuf,"%s\t給%s\t%d\t%s", cuser.userid, id, money,
@@ -387,6 +399,7 @@ int p_give() {
genbuf[0] = 'n';
getdata(3, 0, "要自行書寫紅包袋嗎?[y/N]", genbuf, 2, LCECHO);
mail_redenvelop(cuser.userid, id, money, genbuf[0]);
+ vice(tax, "贈與稅");
}
return 0;
}