TempleOSCD_140715.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:46:09 +02:00
1 parent 7ef616a20e
commit 64f679eeb9
1095 files changed
+24814 -221011

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
$FG,6$JOB
$FG,1$BANK
$FG,4$CREDIT
$FG,2$CASH
$FG,0$RENT
CAR
UTILITIES
MISC
CLOTHS
HEALTH
CHARITY
+75
View File
@@ -0,0 +1,75 @@
U0 BgtAcctsUpdate()
{
CBgtEntry *tempb;
CBgtTemplate *tempt;
tempb=b_root.next;
while (tempb!=&b_root) {
if (tempb->type!=BE_TEMPLATE_COPY) {
tempb->credit_index =StrFileAdd(tempb->credit,accts_table);
tempb->debit_index =StrFileAdd(tempb->debit,accts_table);
}
tempb=tempb->next;
}
tempt=t_root.next;
while (tempt!=&t_root) {
tempt->b.credit_index =StrFileAdd(tempt->b.credit,accts_table);
tempt->b.debit_index =StrFileAdd(tempt->b.debit,accts_table);
tempt=tempt->next;
}
}
U0 BgtAcctsWrite()
{
BgtAcctsUpdate;
StrFileWrite(BGT_ACCTS_FILE,accts_table,TRUE);
}
U0 BgtAcctsRead()
{
I64 i,max_num;
U8 *colors,**s=StrFileRead(BGT_ACCTS_FILE,&max_num,&colors,TRUE);
StrFileDel(accts_table);
accts_table=HashTableNew(0x200);
for (i=0;i<=max_num;i++)
if (s[i])
StrFileAdd(s[i],accts_table,colors[i]);
StrFileArrDel(s,max_num);
Free(colors);
}
I64 BgtAcctColor(U8 *st)
{
CHashGeneric *temph;
if (temph=HashFind(st,accts_table,SFT_GENERIC))
return temph->user_data1;
else
return BLACK;
}
U8 *BgtPopUpAcct(U8 *header=NULL,U8 *dft=NULL)
{
U8 *result;
CDoc *doc=DocNew;
CDocEntry *doc_e,*doc_dft=NULL;
CHashGeneric *temph;
if (header)
DocPrint(doc,"%s",header);
temph=accts_table->next_added;
while (temph!=accts_table) {
doc_e=DocPrint(doc,"$$FG,%d$$$$MU-UL,\"%s\",LE=0x%X$$\n",
temph->user_data1,temph->str,temph->str);
if (dft && !StrCmp(dft,temph->str))
doc_dft=doc_e;
temph=temph->next_added;
}
if (doc_dft) {
doc->cur_entry=doc_dft;
doc->cur_data_col=0;
}
result=PopUpMenu(doc,DOF_DONT_HOME);
DocDel(doc);
return result;
}
+71
View File
@@ -0,0 +1,71 @@
U0 BgtEntryDel2(CBgtEntry *tempb)
{
if (tempb->type!=BE_TEMPLATE_COPY) {
Free(tempb->credit);
Free(tempb->debit);
Free(tempb->desc);
}
}
U0 BgtEntryDel(CBgtEntry *tempb)
{
BgtEntryDel2(tempb);
Free(tempb);
}
U0 BgtIns(CBgtEntry *tempb)
{
CBgtEntry *tempb1=b_root.next;
while (tempb1!=&b_root && tempb1->date<tempb->date)
tempb1=tempb1->next;
QueIns(tempb,tempb1->last);
}
class CBgtEntryForm
{
U8 date[512] fmtstr "$$DA-P,511,A=\"Date :%s\"$$\n";
F64 amount fmtstr "Amount $$$$$$DA,511,A=\"%6.2f\"$$\n";
U8 credit[512] fmtstr "$$DA-P,511,A=\"Credit Acct:%s\"$$\n";
U8 debit [512] fmtstr "$$DA-P,511,A=\"Debit Acct:%s\"$$\n";
U8 desc [512] fmtstr "$$DA-P,511,A=\"Desc :%s\"$$\n";
};
CBgtEntry *BgtEntryPmt(CBgtEntry *dft=NULL)
{
CBgtEntryForm b;
CBgtEntry *tempb;
U8 *st;
MemSet(&b,0,sizeof(CBgtEntryForm));
StrCpy(&b.date,"*");
if (dft) {
StrPrint(b.date,"%D",dft->date);
b.amount=dft->amount;
StrCpy(b.credit,dft->credit);
StrCpy(b.debit ,dft->debit);
StrCpy(b.desc ,dft->desc);
}
while (TRUE)
if (PopUpForm(&b)) {
if (!*b.credit) {
st=BgtPopUpAcct("Credit Acct\n\n");
if (st!=DOCM_CANCEL)
StrCpy(b.credit,st);
} else if (!*b.debit) {
st=BgtPopUpAcct("Debit Acct\n\n");
if (st!=DOCM_CANCEL)
StrCpy(b.debit,st);
} else {
tempb=CAlloc(sizeof(CBgtEntry));
tempb->date =Str2Date(b.date);
tempb->amount=b.amount;
tempb->credit=StrNew(b.credit);
tempb->debit =StrNew(b.debit);
tempb->desc =StrNew(b.desc);
tempb->type =BE_NORMAL;
StrFileAdd(tempb->credit,accts_table);
StrFileAdd(tempb->debit,accts_table);
return tempb;
}
} else
return NULL;
}
+137
View File
@@ -0,0 +1,137 @@
U0 BgtDataRead()
{
CBgtEntry *tempb;
CBgtTemplate *tempt;
I64 i,cnt,size;
U8 *b,*ptr;
I64 max_num;
U8 **s=StrFileRead(BGT_STRINGS_FILE,&max_num);
MemSet(&b_root,0,sizeof(CBgtEntry));
QueInit(&b_root);
b_root.date=Now;
MemSet(&t_root,0,sizeof(CBgtTemplate));
QueInit(&t_root);
t_root.b.date=Now;
if (ptr=b=FileRead(BGT_DATA_FILE,&size)) {
cnt=*ptr(I64 *)++;
for (i=0;i<cnt;i++) {
tempb=CAlloc(sizeof(CBgtEntry));
MemCpy(&tempb->start,ptr,BE_SIZE);
tempb->credit=StrNew(s[tempb->credit_index]);
tempb->debit =StrNew(s[tempb->debit_index]);
tempb->desc =StrNew(s[tempb->desc_index]);
QueIns(tempb,b_root.last);
ptr+=BE_SIZE;
}
cnt=*ptr(I64 *)++;
for (i=0;i<cnt;i++) {
tempt=CAlloc(sizeof(CBgtTemplate));
MemCpy(&tempt->start,ptr,BT_SIZE);
ptr+=BT_SIZE;
MemCpy(&tempt->b.start,ptr,BE_SIZE);
ptr+=BE_SIZE;
tempt->b.credit=StrNew(s[tempt->b.credit_index]);
tempt->b.debit =StrNew(s[tempt->b.debit_index]);
tempt->b.desc =StrNew(s[tempt->b.desc_index]);
QueIns(tempt,t_root.last);
}
}
StrFileArrDel(s,max_num);
Free(b);
BgtAcctsUpdate;
}
U0 BgtDataWrite()
{
I64 size,cnt1,cnt2;
CHashTable *table=HashTableNew(0x1000);
CBgtEntry *tempb;
CBgtTemplate *tempt;
CHashGeneric *temph;
U8 *buf,*ptr;
temph=accts_table->next_added;
while (temph!=accts_table) {
StrFileAdd(temph->str,table); //Make so accts come first. (Cosmetic)
temph=temph->next_added;
}
tempb=b_root.next;
cnt1=0;
while (tempb!=&b_root) {
if (tempb->type!=BE_TEMPLATE_COPY) {
tempb->credit_index =StrFileAdd(tempb->credit,table);
tempb->debit_index =StrFileAdd(tempb->debit,table);
tempb->desc_index =StrFileAdd(tempb->desc,table);
cnt1++;
}
tempb=tempb->next;
}
tempt=t_root.next;
cnt2=0;
while (tempt!=&t_root) {
tempt->b.credit_index =StrFileAdd(tempt->b.credit,table);
tempt->b.debit_index =StrFileAdd(tempt->b.debit,table);
tempt->b.desc_index =StrFileAdd(tempt->b.desc,table);
cnt2++;
tempt=tempt->next;
}
StrFileWrite(BGT_STRINGS_FILE,table);
StrFileDel(table);
size=sizeof(I64)*2+cnt1*BE_SIZE+cnt2*(BT_SIZE+BE_SIZE);
buf=ptr=MAlloc(size);
MemCpy(ptr,&cnt1,sizeof(I64));
ptr+=sizeof(I64);
tempb=b_root.next;
while (tempb!=&b_root) {
if (tempb->type!=BE_TEMPLATE_COPY) {
MemCpy(ptr,&tempb->start,BE_SIZE);
ptr+=BE_SIZE;
}
tempb=tempb->next;
}
MemCpy(ptr,&cnt2,sizeof(I64));
ptr+=sizeof(I64);
tempt=t_root.next;
while (tempt!=&t_root) {
MemCpy(ptr,&tempt->start,BT_SIZE);
ptr+=BT_SIZE;
MemCpy(ptr,&tempt->b.start,BE_SIZE);
ptr+=BE_SIZE;
tempt=tempt->next;
}
FileWrite(BGT_DATA_FILE,buf,size);
Free(buf);
}
U0 BgtDel()
{
CBgtEntry *tempb,*tempb1;
CBgtTemplate *tempt,*tempt1;
tempb=b_root.next;
while (tempb!=&b_root) {
tempb1=tempb->next;
BgtEntryDel2(tempb);
Free(tempb);
tempb=tempb1;
}
tempt=t_root.next;
while (tempt!=&t_root) {
tempt1=tempt->next;
BgtEntryDel2(&tempt->b);
Free(tempt);
tempt=tempt1;
}
StrFileDel(accts_table);
accts_table=NULL;
}
+210
View File
@@ -0,0 +1,210 @@
extern U0 BgtRegen();
Bool BgtPutKey(CDoc *doc,U8 *,I64 ch,I64 sc)
{//ch=ASCII; sc=scan_code
nounusedwarn sc;
CBgtEntry *tempb,*tempb1;
CBgtTemplate *tempt,*tempt1;
CDocEntry *doc_ce;
U8 *st;
switch (ch) {
case '\n':
if ((doc_ce=doc->cur_entry) && doc_ce!=doc && doc_ce->type_u8==DOCT_MENU_VAL) {
tempb=doc_ce->user_data;
if (tempt=tempb->template) {
if (tempt1=BgtTemplatePmt(tempt)) {
QueRem(tempt);
BgtTemplatePurge(tempt);
BgtEntryDel2(&tempt->b);
Free(tempt);
QueIns(tempt1,t_root.last);
BgtTemplateExpand(tempt1);
BgtRegen;
}
} else {
if (tempb1=BgtEntryPmt(tempb)) {
QueRem(tempb);
BgtEntryDel(tempb);
BgtIns(tempb1);
BgtRegen;
}
}
}
return TRUE;
case CH_CTRLY:
if ((doc_ce=doc->cur_entry) && doc_ce!=doc && doc_ce->type_u8==DOCT_MENU_VAL) {
tempb=doc_ce->user_data;
if (tempt=tempb->template) {
QueRem(tempt);
BgtTemplatePurge(tempt);
BgtEntryDel2(&tempt->b);
Free(tempt);
} else {
QueRem(tempb);
BgtEntryDel(tempb);
}
BgtRegen;
}
return TRUE;
case 'a':
PopUpOk( "Set the name and color of your accounts.\n"
"To delete accounts, manually edit\n"
"$$GREEN$$HOME/Budget/Accts.TXT.Z$$FG$$.");
if (PopUpEd(BGT_ACCTS_FILE,Fs)) {
BgtAcctsRead;
BgtRegen;
}
return TRUE;
case 'v':
if ((st=BgtPopUpAcct("View Acct\n\n",view_acct))>=0) {
StrCpy(view_acct,st);
BgtRegen;
}
return TRUE;
case 'n':
if (tempb1=BgtEntryPmt) {
BgtIns(tempb1);
BgtRegen;
}
return TRUE;
case 't':
if (tempt1=BgtTemplatePmt) {
QueIns(tempt1,t_root.last);
BgtTemplateExpand(tempt1);
BgtRegen;
}
return TRUE;
case 'c':
if ((doc_ce=doc->cur_entry) && doc_ce!=doc && doc_ce->type_u8==DOCT_MENU_VAL)
tempb=doc_ce->user_data;
else
tempb=NULL;
if (tempb1=BgtEntryPmt(tempb)) {
BgtIns(tempb1);
BgtRegen;
}
return TRUE;
}
return FALSE;
}
U0 BgtRegen()
{
I64 timeout_jiffy,c,color=COLOR_INVALID;
F64 balance=0;
CDoc *doc,*pdoc,*ddoc;
CDocEntry *doc_ce;
CBgtEntry *tempb=b_root.next,*tempb_ce;
doc=DocNew;
doc->flags|=DOCF_FORM;
while (tempb!=&b_root) {
if (!StrCmp(view_acct,tempb->credit))
balance-=tempb->amount;
if (!StrCmp(view_acct,tempb->debit))
balance+=tempb->amount;
c=BgtAcctColor(tempb->credit);
if (c!=color) {
color=c;
DocPrint(doc,"$$FG,%d$$",color);
}
tempb->doc_e=DocPrint(doc,"$$MU-UL,\"%D %8ts %8ts:%8.2f %8.2f:%Q\",U=0x%X$$\n",
tempb->date,tempb->credit,tempb->debit,balance,
tempb->amount,tempb->desc,tempb);
tempb=tempb->next;
}
DocRecalc(doc);
if (pdoc=Fs->put_doc) {
DocLock(pdoc);
//Now, we want to preserve old position in doc, using ugly brute force.
//It's tricky -- can't use old line num because of editor filters.
//The price we pay for using the standard document editor is this kludge.
//When I originally wrote my budget program, I did not have separate budget
//and line entries, so we never had to resync.
doc_ce=pdoc->cur_entry;
timeout_jiffy=cnts.jiffies+JIFFY_FREQ; //Max one second.
while (doc_ce!=pdoc && cnts.jiffies<timeout_jiffy) {
while (doc_ce->type_u8!=DOCT_MENU_VAL || !(tempb_ce=doc_ce->user_data)) {
doc_ce=doc_ce->next;
if (doc_ce==pdoc) goto br_cont;
}
tempb=b_root.next;
while (tempb!=&b_root) {
if (tempb==tempb_ce) {
doc->cur_entry=tempb->doc_e;
doc->cur_data_col=0;
DocCenter(doc);
goto br_cont;
}
tempb=tempb->next;
}
doc_ce=doc_ce->next;
}
}
br_cont:
ddoc=Fs->display_doc;
Fs->put_doc =doc;
Fs->display_doc=doc;
DocDel(pdoc);
if (pdoc!=ddoc)
DocDel(ddoc);
doc->user_put_key=&BgtPutKey;
}
U0 Budget()
{
CDoc *pdoc,*ddoc,*old_put,*old_display;
BgtAcctsRead;
BgtDataRead;
CBgtTemplatesExpand;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
WinMax;
WinBorder;
WordStat;
MenuPush(
"File {"
" Abort(,CH_SHIFT_ESC);"
" Exit(,CH_ESC);"
"}"
"Edit {"
" NewEntry(,'n');"
" CopyEntry(,'c');"
" EditEntry(,'\n');"
" DeleteEntry(,CH_CTRLY);"
" NewTemplate(,'t');"
" AcctsFile(,'a');"
"}"
"View {"
" ViewAcct(,'v');"
"}"
);
StrCpy(view_acct,"BANK");
DocMax;
old_put =Fs->put_doc;
old_display =Fs->display_doc;
Fs->put_doc =NULL;
Fs->display_doc=NULL;
BgtRegen;
try
if (View) {
BgtDataWrite;
BgtAcctsWrite;
}
catch
PutExcept;
pdoc=Fs->put_doc;
ddoc=Fs->display_doc;
Fs->put_doc =old_put;
Fs->display_doc=old_display;
DocDel(pdoc);
if (pdoc!=ddoc)
DocDel(ddoc);
SettingsPop;
BgtDel;
MenuPop;
}
+112
View File
@@ -0,0 +1,112 @@
#define SFT_GENERIC 1
public U8 **StrFileRead(U8 *name,I64 *_max_num=NULL,U8 **_colors=NULL,Bool no_nums=FALSE)
{
CDoc *doc=DocRead(name,DOCF_DBL_DOLLARS|DOCF_NO_CURSOR);
CDocEntry *doc_e=doc->root.next;
I64 i,max_num=0;
U8 *ptr,**result,*colors;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_TEXT) {
if (no_nums)
i=++max_num;
else {
i=Str2I64(doc_e->tag,,&ptr);
if (i>max_num) max_num=i;
if (*ptr==',') ptr++;
ptr=StrNew(ptr);
Free(doc_e->tag);
doc_e->tag=ptr;
}
doc_e->user_data=i;
}
doc_e=doc_e->next;
}
result=CAlloc(sizeof(U8 *)*(max_num+1));
colors=CAlloc(sizeof(U8)*(max_num+1));
doc_e=doc->root.next;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_TEXT && 0<=doc_e->user_data<=max_num) {
result[doc_e->user_data]=doc_e->tag;
doc_e->tag=NULL;
colors[doc_e->user_data]=doc_e->type.u8[1]&15;
}
doc_e=doc_e->next;
}
DocDel(doc);
if (_max_num) *_max_num=max_num;
if (_colors)
*_colors=colors;
else
Free(colors);
return result;
}
public U0 StrFileArrDel(U8 **a,I64 max_num)
{
I64 i;
for (i=0;i<=max_num;i++)
Free(a[i]);
Free(a);
}
public I64 StrFileAdd(U8 *st,CHashTable *table,I64 color=COLOR_INVALID)
{
CHashGeneric *temph;
if (!st) return 0;
if (!(temph=HashFind(st,table,SFT_GENERIC))) {
temph=CAlloc(sizeof(CHashGeneric));
temph->type=SFT_GENERIC;
temph->str=StrNew(st);
if (table->last_added==table)
temph->user_data0=1;
else
temph->user_data0=table->last_added(CHashGeneric *)->user_data0+1;
HashAdd(temph,table);
}
if (color!=COLOR_INVALID)
temph->user_data1=color;
return temph->user_data0;
}
public U0 StrFileWrite(U8 *name,CHashTable *table,Bool no_nums=FALSE)
{
I64 color=BLACK;
CDoc *doc=DocNew(name);
CHashGeneric *temph;
if (table) {
temph=table->next_added;
while (temph!=table) {
if (temph->user_data1&15!=color) {
DocPrint(doc,"$$FG,%d$$",temph->user_data1&15);
color=temph->user_data1&15;
}
if (no_nums)
DocPrint(doc,"%s\n",temph->str);
else
DocPrint(doc,"%d,%s\n",temph->user_data0,temph->str);
temph=temph->next_added;
}
}
doc->flags|=DOCF_NO_CURSOR;
DocWrite(doc);
DocDel(doc);
}
public U0 StrFileDel(CHashTable *table)
{
CHashGeneric *temph,*temph1;
if (!table) return;
temph=table->next_added;
while (temph!=table) {
temph1=temph->next_added;
Free(temph->str);
Free(temph);
temph=temph1;
}
Free(table->body);
Free(table);
}
+147
View File
@@ -0,0 +1,147 @@
U0 BgtTemplatePurge(CBgtTemplate *tempt)
{
CBgtEntry *tempb,*tempb1;
tempb=b_root.next;
while (tempb!=&b_root) {
tempb1=tempb->next;
if (tempb->template==tempt) {
QueRem(tempb);
BgtEntryDel2(tempb);
Free(tempb);
}
tempb=tempb1;
}
}
U0 BgtTemplateExpand(CBgtTemplate *tempt)
{
CDate d,start,end;
CDateStruct ds;
CBgtEntry *tempb;
start=MyStr2Date(tempt->start_date);
end =MyStr2Date(tempt->end_date);
tempt->b.template=tempt;
switch (tempt->type) {
case BT_INTERVAL:
d=start;
while (d<=end) {
tempb=CAlloc(sizeof(CBgtEntry));
MemCpy(tempb,&tempt->b,sizeof(CBgtEntry));
tempb->date=d;
tempb->type=BE_TEMPLATE_COPY;
BgtIns(tempb);
d+=tempt->period*0x100000000;
}
break;
case BT_MONTHLY:
Date2Struct(&ds,start);
while (TRUE) {
d=Struct2Date(&ds);
if (d<=end) {
tempb=CAlloc(sizeof(CBgtEntry));
MemCpy(tempb,&tempt->b,sizeof(CBgtEntry));
tempb->date=d;
tempb->type=BE_TEMPLATE_COPY;
BgtIns(tempb);
} else
break;
if (++ds.mon>11) {
ds.mon=0;
ds.year++;
}
}
break;
case BT_BIMONTHLY:
Date2Struct(&ds,start);
while (TRUE) {
d=Struct2Date(&ds);
if (d<=end) {
tempb=CAlloc(sizeof(CBgtEntry));
MemCpy(tempb,&tempt->b,sizeof(CBgtEntry));
tempb->date=d;
tempb->type=BE_TEMPLATE_COPY;
BgtIns(tempb);
} else
break;
ds.mon+=2;
if (ds.mon>11) {
ds.mon-=12;
ds.year++;
}
}
break;
case BT_SEMIANNUAL:
Date2Struct(&ds,start);
while (TRUE) {
d=Struct2Date(&ds);
if (d<=end) {
tempb=CAlloc(sizeof(CBgtEntry));
MemCpy(tempb,&tempt->b,sizeof(CBgtEntry));
tempb->date=d;
tempb->type=BE_TEMPLATE_COPY;
BgtIns(tempb);
} else
break;
ds.mon+=6;
if (ds.mon>11) {
ds.mon-=12;
ds.year++;
}
}
break;
case BT_ANNUAL:
Date2Struct(&ds,start);
while (TRUE) {
d=Struct2Date(&ds);
if (d<=end) {
tempb=CAlloc(sizeof(CBgtEntry));
MemCpy(tempb,&tempt->b,sizeof(CBgtEntry));
tempb->date=d;
tempb->type=BE_TEMPLATE_COPY;
BgtIns(tempb);
} else
break;
ds.year++;
}
break;
}
}
U0 CBgtTemplatesExpand()
{
CBgtTemplate *tempt=t_root.next;
while (tempt!=&t_root) {
BgtTemplateExpand(tempt);
tempt=tempt->next;
}
}
CBgtTemplate *BgtTemplatePmt(CBgtTemplate *dft_t=NULL)
{
CBgtTemplate t,*tempt;
CBgtEntry *tempb,*dft_b;
MemSet(&t,0,sizeof(CBgtTemplate));
if (dft_t) {
MemCpy(&t.start,&dft_t->start,BT_SIZE);
dft_b=&dft_t->b;
} else {
t.type=BT_INTERVAL;
StrCpy(&t.start_date,"[");
StrCpy(&t.end_date,"]");
dft_b=NULL;
}
while (TRUE)
if (PopUpForm(&t) && ((t.type==BT_INTERVAL && t.period>0) ||
t.type>BT_INTERVAL)) {
if (tempb=BgtEntryPmt(dft_b)) {
tempt=CAlloc(sizeof(CBgtTemplate));
MemCpy(&tempt->start,&t.start,BT_SIZE);
MemCpy(&tempt->b,tempb,sizeof(CBgtEntry));
Free(tempb);
return tempt;
}
} else
break;
return NULL;
}
+76
View File
@@ -0,0 +1,76 @@
#define BGT_STRINGS_FILE "HOME/Budget/Strs.TXT.Z"
#define BGT_ACCTS_FILE "HOME/Budget/Accts.TXT.Z"
#define BGT_DATA_FILE "HOME/Budget/Bgt.DAT.Z"
#define BE_NORMAL 0
#define BE_GAS 1
#define BE_ANNIVERSARY 2
#define BE_PRICE 3
#define BE_TEMPLATE_COPY 4
extern class CBgtTemplate;
class CBgtEntry
{
CBgtEntry *next,*last;
U0 start;
CDate date;
U16 type,flags;
U32 credit_index,debit_index,desc_index;
F64 amount;
U0 end;
U8 *credit,*debit,*desc;
CBgtTemplate *template;
CDocEntry *doc_e;
} b_root;
#define BE_SIZE (offset(CBgtEntry.end)-offset(CBgtEntry.start))
#define BT_NULL 0
#define BT_INTERVAL 1
#define BT_MONTHLY 2
#define BT_BIMONTHLY 3
#define BT_SEMIANNUAL 4
#define BT_ANNUAL 5
DefineLstLoad("ST_BGT_TEMPLATE_TYPES",
"Null\0Interval\0Monthly\0Bimonthly\0Semiannual\0Annual\0");
class CBgtTemplate
{
CBgtTemplate *next,*last;
U0 start;
U16 type fmtstr "$$LS,RT=U16,D=\"ST_BGT_TEMPLATE_TYPES\"$$\n";
U16 flags;
U8 start_date[16] fmtstr "$$DA-P,15,A=\"Start Date:%s\"$$\n";
U8 end_date[16] fmtstr "$$DA-P,15,A=\"End Date :%s\"$$\n";
F64 period fmtstr "$$DA,511, A=\"Period :%6.2f\"$$\n";
U0 end;
CBgtEntry b;
} t_root;
#define BT_SIZE (offset(CBgtTemplate.end)-offset(CBgtTemplate.start))
U8 view_acct[512];
CHashTable *accts_table=NULL;
CDate MyStr2Date(U8 *st)
{
CDateStruct ds;
CDate result;
if (st&&*st) {
if (StrOcc(st,'['))
result=b_root.next->date;
else if (StrOcc(st,']'))
result=b_root.last->date;
else
result=Str2Date(st);
} else
result=Now;
Date2Struct(&ds,result);
if (ds.year>2050)
ds.year-=100;
return Struct2Date(&ds);
}
+4
View File
@@ -0,0 +1,4 @@
if (!FileFind("HOME/Budget",,FUF_JUST_DIRS)) {
MkDir("HOME/Budget");
Copy("/Apps/Budget/Accts.TXT.Z","HOME/Budget");
}
+11
View File
@@ -0,0 +1,11 @@
#help_index "Finance"
#include "/Apps/Budget/BgtStrs"
#include "/Apps/Budget/Budget"
#include "/Apps/Budget/BgtAccts"
#include "/Apps/Budget/BgtEntry"
#include "/Apps/Budget/BgtTemplate"
#include "/Apps/Budget/BgtFile"
#include "/Apps/Budget/BgtMain"
#help_index ""
+4
View File
@@ -0,0 +1,4 @@
Cd("/Apps/Budget");;
#include "Load"
#include "Install" //Might as well always install
Budget;