ZealOS/docs/Apps/Budget/BgtEntry.CC.html

126 lines
9.9 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.05">
<style type="text/css">
body {background-color:#000000;}
.cF0{color:#ffffff;background-color:#000000;}
.cF1{color:#3465a4;background-color:#000000;}
.cF2{color:#4e9a06;background-color:#000000;}
.cF3{color:#06989a;background-color:#000000;}
.cF4{color:#a24444;background-color:#000000;}
.cF5{color:#75507b;background-color:#000000;}
.cF6{color:#ce982f;background-color:#000000;}
.cF7{color:#bcc0b9;background-color:#000000;}
.cF8{color:#555753;background-color:#000000;}
.cF9{color:#729fcf;background-color:#000000;}
.cFA{color:#82bc49;background-color:#000000;}
.cFB{color:#34e2e2;background-color:#000000;}
.cFC{color:#ac3535;background-color:#000000;}
.cFD{color:#ad7fa8;background-color:#000000;}
.cFE{color:#fce94f;background-color:#000000;}
.cFF{color:#000000;background-color:#000000;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF1>U0</span><span class=cF0> BgtEntryDel2(CBgtEntry *tmpb)
<a name="l2"></a>{
<a name="l3"></a> </span><span class=cF1>if</span><span class=cF0> (tmpb-&gt;type != BE_TEMPLATE_COPY)
<a name="l4"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l5"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpb-&gt;credit);
<a name="l6"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpb-&gt;debit);
<a name="l7"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpb-&gt;desc);
<a name="l8"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l9"></a>}
<a name="l10"></a>
<a name="l11"></a>CBgtEntry *BgtEntryCopy(CBgtEntry *tmpb, </span><span class=cF1>Bool</span><span class=cF0> periodic_copy)
<a name="l12"></a>{
<a name="l13"></a> CBgtEntry *res = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CBgtEntry</span><span class=cF7>)</span><span class=cF0>);
<a name="l14"></a>
<a name="l15"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(res, tmpb, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CBgtEntry</span><span class=cF7>)</span><span class=cF0>);
<a name="l16"></a> </span><span class=cF1>if</span><span class=cF0> (periodic_copy)
<a name="l17"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l18"></a> res-&gt;credit = </span><span class=cF5>StrNew</span><span class=cF0>(tmpb-&gt;credit);
<a name="l19"></a> res-&gt;debit = </span><span class=cF5>StrNew</span><span class=cF0>(tmpb-&gt;debit);
<a name="l20"></a> res-&gt;desc = </span><span class=cF5>StrNew</span><span class=cF0>(tmpb-&gt;desc);
<a name="l21"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l22"></a>
<a name="l23"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l24"></a>}
<a name="l25"></a>
<a name="l26"></a></span><span class=cF1>U0</span><span class=cF0> BgtEntryDel(CBgtEntry *tmpb)
<a name="l27"></a>{
<a name="l28"></a> BgtEntryDel2(tmpb);
<a name="l29"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpb);
<a name="l30"></a>}
<a name="l31"></a>
<a name="l32"></a></span><span class=cF1>U0</span><span class=cF0> BgtIns(CBgtEntry *tmpb)
<a name="l33"></a>{
<a name="l34"></a> CBgtEntry *tmpb1 = b_head.next;
<a name="l35"></a>
<a name="l36"></a> </span><span class=cF1>while</span><span class=cF0> (tmpb1 != &amp;b_head &amp;&amp; tmpb1-&gt;date &lt; tmpb-&gt;date)
<a name="l37"></a> tmpb1 = tmpb1-&gt;next;
<a name="l38"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpb, tmpb1-&gt;last);
<a name="l39"></a>}
<a name="l40"></a>
<a name="l41"></a></span><span class=cF1>class</span><span class=cF0> CBgtEntryForm
<a name="l42"></a>{
<a name="l43"></a> </span><span class=cF1>U8</span><span class=cF0> date [</span><span class=cFE>512</span><span class=cF0>] format </span><span class=cF6>&quot;$DA-P,A=\&quot;Date :%s\&quot;$\n&quot;</span><span class=cF0>;
<a name="l44"></a> </span><span class=cF1>F64</span><span class=cF0> amount format </span><span class=cF6>&quot;Amount $$$DA,A=\&quot;%10.2f\&quot;$\n&quot;</span><span class=cF0>;
<a name="l45"></a> </span><span class=cF1>U8</span><span class=cF0> credit [</span><span class=cFE>512</span><span class=cF0>] format </span><span class=cF6>&quot;$DA-P,A=\&quot;Credit (from) Acct:%s\&quot;$\n&quot;</span><span class=cF0>;
<a name="l46"></a> </span><span class=cF1>U8</span><span class=cF0> debit [</span><span class=cFE>512</span><span class=cF0>] format </span><span class=cF6>&quot;$DA-P,A=\&quot;Debit (to) Acct:%s\&quot;$\n&quot;</span><span class=cF0>;
<a name="l47"></a> </span><span class=cF1>U8</span><span class=cF0> desc [</span><span class=cFE>512</span><span class=cF0>] format </span><span class=cF6>&quot;$DA-P,A=\&quot;Desc :%s\&quot;$\n&quot;</span><span class=cF0>;
<a name="l48"></a>};
<a name="l49"></a>
<a name="l50"></a>CBgtEntry *BgtEntryPrompt(CBgtEntry *</span><span class=cF1>default</span><span class=cF0>=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l51"></a>{
<a name="l52"></a> CBgtEntryForm b;
<a name="l53"></a> CBgtEntry *tmpb;
<a name="l54"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
<a name="l55"></a>
<a name="l56"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&amp;b, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CBgtEntryForm</span><span class=cF7>)</span><span class=cF0>);
<a name="l57"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(&amp;b.date, </span><span class=cF6>&quot;*&quot;</span><span class=cF0>);
<a name="l58"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>default</span><span class=cF0>)
<a name="l59"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l60"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(b.date, </span><span class=cF6>&quot;%D&quot;</span><span class=cF0>, </span><span class=cF1>default</span><span class=cF0>-&gt;date);
<a name="l61"></a> b.amount = </span><span class=cF1>default</span><span class=cF0>-&gt;amount;
<a name="l62"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(b.credit, </span><span class=cF1>default</span><span class=cF0>-&gt;credit);
<a name="l63"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(b.debit , </span><span class=cF1>default</span><span class=cF0>-&gt;debit);
<a name="l64"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(b.desc , </span><span class=cF1>default</span><span class=cF0>-&gt;desc);
<a name="l65"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l66"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>PopUpForm</span><span class=cF7>(</span><span class=cF0>&amp;b</span><span class=cF7>)</span><span class=cF0>)
<a name="l68"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l69"></a> </span><span class=cF1>if</span><span class=cF0> (!*b.credit)
<a name="l70"></a> {
<a name="l71"></a> st = BgtPopUpAcct(</span><span class=cF6>&quot;Credit Acct\n\n&quot;</span><span class=cF0>);
<a name="l72"></a> </span><span class=cF1>if</span><span class=cF0> (st != </span><span class=cF3>DOCM_CANCEL</span><span class=cF0>)
<a name="l73"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(b.credit, st);
<a name="l74"></a> }
<a name="l75"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!*b.debit)
<a name="l76"></a> {
<a name="l77"></a> st = BgtPopUpAcct(</span><span class=cF6>&quot;Debit Acct\n\n&quot;</span><span class=cF0>);
<a name="l78"></a> </span><span class=cF1>if</span><span class=cF0> (st != </span><span class=cF3>DOCM_CANCEL</span><span class=cF0>)
<a name="l79"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(b.debit, st);
<a name="l80"></a> }
<a name="l81"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l82"></a> {
<a name="l83"></a> tmpb = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CBgtEntry</span><span class=cF7>)</span><span class=cF0>);
<a name="l84"></a> tmpb-&gt;date = </span><span class=cF5>Str2Date</span><span class=cF0>(b.date);
<a name="l85"></a> tmpb-&gt;amount = b.amount;
<a name="l86"></a> tmpb-&gt;credit = </span><span class=cF5>StrNew</span><span class=cF0>(b.credit);
<a name="l87"></a> tmpb-&gt;debit = </span><span class=cF5>StrNew</span><span class=cF0>(b.debit);
<a name="l88"></a> tmpb-&gt;desc = </span><span class=cF5>StrNew</span><span class=cF0>(b.desc);
<a name="l89"></a> tmpb-&gt;type = BE_NORMAL;
<a name="l90"></a> StrFileAdd(tmpb-&gt;credit, &amp;accts_table_strs, accts_table);
<a name="l91"></a> StrFileAdd(tmpb-&gt;debit, &amp;accts_table_strs, accts_table);
<a name="l92"></a> </span><span class=cF1>return</span><span class=cF0> tmpb;
<a name="l93"></a> }
<a name="l94"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l95"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l96"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l97"></a>}
</span></pre></body>
</html>