You are on page 1of 19
ascot Cf cote Fer tating AD ry ora Lager Posing - Mata Cn ee eg re ‘@7€+Cedger Posting - Mett Douglas Miller Dec 03 2015 Article 0 4 15.2k Download 100% FREE Spire Office APIs Introduction This is the second method I created for performing a double entry posting to Chart Of Accounts. The first one involved “coloring” the Chart Of Accounts listing displayed in the Windows form to discern the difference between the initial postings and the offsetting postings to the user. That was my own idea for making the double entry posting for the application and it worked well, but the customer had another idea, Itwas based on how he manually performed double entry postings with pen and paper. His idea is also very good and it will be the subject of this article Here's my first article: Ci# Code For Making a Double Entry General Ledger Posting - Method 1 Moving Forward Figure 1 is the pop up menu from this program for performing double entry postings to Chart OF Accounts. The option titled, “Add And Remove Double Entry Postings" has already been described in the article | wrote by the same name as this one for "Method 1”. “Add And Remove General Ledgers" is for adding and removing general ledgers from Chart Of Accounts. It does not involve the double entry posting process htiplww.c-sharpomer.con/UplosdFle!87864/0-Sharp-code-formaking-s-double-entry-general-ledger-posting-m ane sisv2017 (CH Code For Making A Double Entry General Ledger Posting - Method 2 “Pnait OF Recounts Reporting —"S«* question {bout Add And Remove Double Entry Postings Add And Remove General Ledgers © "OD" Ledgers Maintenance "CR" Ledgers Maintenance "GL" Ledgers Maintenance "J" Ledgers Maintenance “PR" Ledgers Maintenance "ST" Ledgers Maintenance Figure 1 ‘The other options described as "CD Ledgers Maintenance" (cash disbursements), "CR Ledgers Maintenance’ (cash receipts), "GL Ledgers Maintenance" (general ledger), "/ Ledgers Maintenance’ (journal entry), "PR Ledgers Maintenance" (payroll) and "ST Ledgers Maintenance’ (standard transaction) are double entry posting utilities, which are the subject of this article. In terms of programming, they are all mechanically identical, though the listing of general ledgers within each of these utilities differs. For the purpose of not being redundant, | will describe in detail the functions of the “CD Ledgers Maintenance" Windows form. A description of the initial posting procedure, hip lwwn.c-sharpcomer.conVUploadFile!87864IC-Sharp-code-fr-making-e-double-entry-general-ledger-posting-m 2n9 sisv2017 (CH Code For Making A Double Entry General Ledger Posting - Method 2 "CO Lesgen tenance o x ASK A QUESTION Re C#Corner Alisting of pre-determined general ledger accounts along with their DR (debit) and CR (credil) columns showing the total debit and credit amounts to be posted to each account are displayed in a list box above in Figure 2, The text boxes located directly below are for entering debit and credit amounts. When you enter an amount in either or both of two text boxes and then click the “Post The Debit And/Or Credit Amounts Entered For The Highlighted GL#’ button immediately to the right, the program will post the debit and credit amount(s) entered in the corresponding column in whatever general ledger account in the list box you had previously highlighted with the mouse. There is also a "Yes or No" dropdown for adding the entered amount(s) to the previous fiscal year if desired. And there is a text box for allowing the user to override the current date for this transaction with an alternate date to be entered by the user (the current date is auto entered by default upon loading the form). Figures 3, 4 and 5 below illustrate the ial posting procedure. hip iwwn:.c-sharpcomer.conVUploadFile!87864/C-Sharp-code-for-making-2-double-entry-generaledger-posting-mv ane (CH Code For Making A Double Entry General Ledger Posting - Method 2 WP Wer a CRSH CHECKING eee aa 019 PAYROLL 9.09 9.09 020 EREEAID INSURANCE 9.00 9.00 3079 -EMELOYEE ADVANCE 9.00 9.00 STATE WITHOLDING 9.00 9.00 CITY WITHOLDING 0.00 0.00 SBLES TAX PAYABLE 9.00 9.00 ‘rter Debt and/or Credt Aout), hen olck the button io pot hem tothe iced GL athe et. em Post The Debt And/Or Credt Amounts Ertered For The Hohigitec GLE Gredt Amour: | 20000 To Pou fal You? (15 ~] Nw Di Far Sat Torin Ta Ovens Din OFTodye Dt [TV2I7E | Figure 3 Giz GL Name DR cr 3000 CASH CHECKING 9.00 1040 EREPAID INSURANCE 072 EMPLOYEE ADVANCE 9.00 \eificstion Mod 110 STATE WITH 120 CITY WITHoY Da you want ta post the debit and/ar credit amount(s) to this bighVighted general ledger? uso SALES TAX 1% No if ec Figure 4 hip lwwn.c-sharpcomer.conVUploadFile!87864IC-Sharp-code-fr-making-e-double-entry-general-ledger-posting-m ane sisvz017 (CH Code For Making A Double Entry General Ledger Posting - Method 2 ASK A QUESTION PREPAID INSURANCE FEDERAL WITHOLDING STATE WITHOLDINS CITY WITECIDING SALES TAX PAYABLE Figure 5 We have not actually posted to the Chart Of Accounts yet. These postings are only being added to a sort of staging area as a list box on the Windows form. Here is the C# code that details how the “Post The Debit And/Or Credit Amounts Entered For The Highlighted GL#' button works: a. e2. 23. ea. 25. ec. °7 hip lwwn.c-sharpcomer.conVUploadFile!87o864/C-Sharp-code-or private void Posttheanount(object sender, EventArgs e) « J/ declare local variables. string listBoxt string, debit_str, credit_str, previousfiscal; char{] charval_debit, charval_credit, charval_date; 11 get current working directory. currdir = Directory. GetCurrentDirectory(); currdir = currdir.Substring(®, currdir.Length - 9); // verify that a ledger has been selected fron the Chart OF Accounts // Yisting before proceeding. Af (ListBox1.SelectedIndex [= -1) { // grab the selected general ledger fron the Windows form into {1 a string variable, '1istBox1_string’ . ListBox1_String = 11st@ox1.Text} ‘// 4 the general ledger that was selected is invalid, then 11 display a message for this, then abort. if (ListBoxd_string-Substring(®, 1) || ListBox1_string.Substring(@, 1) =='"G") MessageBox.Show("Invali¢ selection...", "Error Mov U1 if the general ledger that was selected is valid, then proceed. Af (Listaoxt_string-Substring(®, 1) " && ListBoxi_String.Substring(@, 1) != °c") « result = MessageBox.show("Do you want to post the debit and/or credit amount(s) to AF (result { Dialogkesult.Yes) 'aking--double-entry-genersHedger-posting-m 5H9 sisv2017 40. 41 42 a3. 4a, 45. 46. 47 48 43 50. 51, 52. 53, 5a. 55. 56. 57. se. 59. oe. el. 2. 83. oa, 65 66. °7 68. 6. 70. nm R. 2. 7A 75. 76. 77. 78. 79. 20. al. 22 a 34 85. 36. 27 38. 29. 90. 91 92. 93 94, 95. 96. 97. 98 99, 10 101 102 103 104, 105 408 107 (CH Code For Making A Double Entry General Ledger Posting - Method 2 11 entered anount(s) to the oe previousfiscal = this.addto SK A QUESTION J] grab the debit and credit anount(s) and convert to character arrays 71 Xo prepare for further processing. debit_str = debitarount Text; credit_str = creditAnount.Text; charval_debit = debit_str.Tochararray(®, debit_str.Length); charval_credit = credit_str.Tochararray(@, credit_str.Length); JI open a file stream to the Chart OF Accounts data file for 71 subsequent read operations Filetnfo datafileinfo = new FileTafo(curedir + sizeofdatafile = datafileinfo.Length; Streameader streanobj = nex StreanReader(currdir + “nastcoa.txt"); streanobj.BaseStream.Seek(®, SeekOrigin.Begin); astcoa.txt"); // initialize the Chart Of Accounts data file offset t datafileoffset = 05 do € 1/ read the next sequential record from the Chart Of Accounts data file. stringval = streanobj.ReadLine()3 // construct a transient general ledger file nane for the current Chart // OF Accounts record and assign it to the variable, ‘strfile_temp’ strfile_temp = stringval.Substring(45, 8) + "_.txt” // compare the general ledger # from the “stringVal' variable to what was 1 selected in the listing on the Windows form. if equal, then proceed wit! 77 the posting of the entered anount(s) to the Windous forn. Af (stringVal.Substring(41, 4) == listBox1_String.Substring(®, 4)) q J/ clear out the character array, ‘recordatavar_transactions’, used 11 for the Windows form posting operation. for (2 = 0; a < GLDETATLEN - 2; at+) recordatavar_transactions[a] = (cl // assign whatever debit and/or credit amount(s) were entered into the 1/ Windows form to the character array, ‘recordatavar_transactions' . for (2 = 0; a < debit_str.Length; a+) recordatavar_transactions[a + 5 for (a = 0; a < credit_str.Length; ar+) recordatavar_transactions[a + // grab the date of the alternate date field and assign 7] it to the variable for the transaction date, ‘dateString’ dateString = NewXctionbate. Text; // if no date was entered in the alternate d: 71 current date to ‘datestring’ iF (dateString. Length < 8) field, then assign the DateTime saveNow = DateTime.Now; dateString = savellow.ToString(datePatt) ; > J/ convert ‘dateString’ to a character array and insert it into the U1 character array ‘recordstavar_transactions', which also holds any W/ debit and/or credit amount(s) entered by the user. charVal_date = dateString.TocharArray(®, datestring. Length); for (a = 0; a < dateString.Length; a+) recordatavar_transactions[a] = // if the user chose to add these debit and/or credit anount(s) to the 1/ previous fiscal year, then use the '*" symbol to denote that in the W/ character array, ‘recordatavar_transactions'. if (previousfiscal == "ves") 4 recordatavar_transactions[2] = '* hip lwwn.c-sharpcomer.conVUploadFile!87864IC-Sharp-code-fr-making-e-double-entry-general-ledger-posting-m ene sisv2017 (CH Code For Making A Double Entry General Ledger Posting - Method 2 U1 transient data #~ temp". FileStream fstreano ir + strfile_temp, Filetor Streamiriter writerooj1 = new streamrater(rstreanob j1); una, writerobj1.}riteline(recordatavar_transactions); us writerobj1.Close(); he fstreanobji.Close(); 23 J advance the Chart OF Accounts data file offset forward by one 12a, 1/ record to the next sequentially located record. 125 dataflleoffset = datafileoffset + GLMASTERLEN; 129 } while (datafileoffset < sizeofdatafile); Be // close the Chart Of Accounts data file stream. 131 streanobj .Close(); 134 /1 repaint the Windows form to reflect the changes. 135 UpdateListing(); 14s. else 146 c 1a MessageBox.Show(*No general ledger selection was made...please try again.", "Error Mod: Adding supplemental general ledger accounts to the initial posting process This next part will discuss the coding | use to add supplemental general ledger accounts to those ledger accounts displayed in the list box by default. This is a flexible feature that allows the user to add as many as 4 ledgers that may need to be incorporated into the initial posting process for any number of reasons. Here is the code that details how the “Add A Supplemental GL Account To The Current List” button functions: e1. | private void AddSupplenentalct (object sender, EventArgs e) e2.| ¢ 23 J/ declare local variables ea. ‘int found_glno; 2. ‘long sizeofdatatile_supplenental; es. string glno_ste, glnane_str; er. char{] charVal_gino, charVal_ginane; ee. 03 10. result = MessageBox.Show("Do you want to adé a supplenental GL account to the current list: uu 2 if (result == DialogResult.Yes) a { 1a. hip lwwn.c-sharpcomer.conVUploadFile!87864IC-Sharp-code-fr-making-e-double-entry-general-ledger-posting-m 79 sisv2017 21 22. 23, 2a. 25. 26. 27. 28. 28) 30. 31 32. 33. 3a 35. 36. 37, 38. 39, 40. a. 42. a3 4a, 45. 46. 47 42 49. 50. 51. 82. 53. 5a. 55. 56. 57. 58. 59. 68. a. 62. 63 6a. 65. 66. 67. 6a 69. 70. na 72. a 74, 75. 76. 7 7. 79) 80. a1 22. 33. 24, 35. 26. 87 38 (CH Code For Making A Double Entry General Ledger Posting - Method 2 JI. data File, ‘ed ledger. txt’. + COrr#EeInfo datafileinfo_supplenental ASK A QUESTION cd_ledger.txt"); sizeofdatafile_supplenental jatafiernro_suppienentai.Length; // 4# the number of added supplemental general ledgers 7] for the current session is less than 5, then proceed if (sizeofdatafile_supplemental < GLAUXILIARY * 5) « // get the user entered susplenental general ledger # to add to 7] the Windows for listing. glno_str = AuxiliaryGLNo. Text; // 3 the Length of the user entered supplenental general 1] ledger # is 4, then proceed. Af (glno_str.Length == 4) { // open a file stream to the Chart Of Accounts data file for 71 subsequent read operations FileInfo datafileinfo = new FileInfo(currdin + "nastcoa.txt"); sizeofdatafile = datafileinfo.Length; StreamReader streanobj = nex StreanReader(currdir + “nastcoa.txt" ‘streamobj .BaseStrean.Seck(@, SeckOrigin.Begin) ; // initialize the Chart Of Accounts data file offset to @ J/ set the ‘Found_gino’ flag to its default of @ to indicate 71 the general ledger # to search for is not yet found. datafileoffset = 0; found_gino = 2; do { // read the next sequential record from the Chart Of Accounts data file. stringVal = streanobj.ReadLine(); // 3€ the user entered general ledger # has been matched in the Chart OF // Accounts data file, then proceed. Af (stringval.Substring(41, 4) == glno_str) « J/ set the ‘found_gino’ flag to 1 to denote the user // entered general ledger # has been matched. found_glno = 1; // construct a transient copy the corresponding general // ledger filename from the Chart OF Accounts record and 7/ assign it to the variable, ‘strfile_tenp'. strfile_tenp = stringval.Substring(45, 8) + °_.txt"; // check to see if this transient general ledger filename 7] already exists and if so, get rid of it. Af (File.Exists(currdir + stefile_temp)) File.velete(currdir + strfile temp); ? J/ clear out the character array, ‘recordatavar_transactions’, J/ used for the supplenental general ledger file addition to the k for (8 = 0; a < GLDFTATLEN + 2; a++) recordatavar_transactions[a] hip lwwn.c-sharpcomer.conVUploadFile!87864IC-Sharp-code-fr-making-e-double-entry-general-ledger-posting-m ane sisv2017 95. 96. 97 38. 99, 102 102 102 103 toa 105, 06 107 108 109 ue aaa a2 13 ua, us us a7 us us hae a2 aaa 123 aa as 126 a7 128 a ae aa 132 133 134, 135 138 37 Ba Be ie 1a aaa 143 14a has 146 a7 14a 1a 152 151 sa 1583 sa) 155 ise 157 18 159 16e 161 162 #Corner y (CH Code For Making A Double Entry General Ledger Posting - Method 2 FileStream fstreano in + strfile_temp, Filewo: Streamwriter writer ASK A QUESTION ‘treamobj1) 5 writerobj1.Weitel ine(recoraatavar_transactions) ; writerobj1 .Close(); fstreamobji.close(); /] adé the supplenental general ledger # entered by the user as well a // descriptive nane to character arrays. charVval_glno = glno_str.Tochararray(@, glno_str.Length); Blnane_str = stringVal .Substring(®, 41); charVal_glnane = glnane_str.TocharArray(@, glnane_str.Length); 11 adé the above 2 itens to the ‘recordatavar_aux_ledger’ character ari for (a = 0; a < 45; at+) recordatavar_aux_ledgera] = (char)32; for (2 = 0; a < 4; att) recondatavar_aux_ledger[a] = charVal_gino[a]; for (2 = 0; 2 < 41; at+) recordatavar_aux_ledger[a + 4] = charVal_ginar // open a file stream to the supplemental cash disbursements data file 11 and append the ‘recordatavar_aux_ledger’ character array to it. FileStream fstreanobj2 = new Filestrean(currdir + "cd_ledger.txt", Fil’ Streankriter weiterobj2 = new Streanbiriter(fstreanobj2) 5 writerobj2.Writel ine(recordatavar_aux_ledger); writerobj2.Close(); fstreamobj2.close(); x 1/ advance the Chart Of Accounts data file offset forward by one 11 record to the next sequentially located record. datafileoffset = datafileoffset + GLMASTERLEN; } while (datafileoffset < sizeofdatafile && found_gino == 0); // close the Chart OF Accounts data file stream. streamobj .Close(); // reset the supplenental general ledger # control on the Windows form to blani ‘this AuxiliaryGLNo.Text = "5 /1 repaint the Windows form to reflect the changes. UpdateListing(); if (found_gino == @) t MessageBox.Show("The GL nunber was not found and was not added to the curr y > else { MessageBox.Show("Invalid GL nunber...please try again.", “Error Node"); , hip lwwn.c-sharpcomer.conVUploadFile!87864IC-Sharp-code-fr-making-e-double-entry-general-ledger-posting-m ene sisv2017 (CH Code For Making A Double Entry General Ledger Posting - Method 2 nessagesox.show(“Unable to ads = ceounts eo." "Enron Mode! € #Comer ASK A QUESTION } 169. ie i 172. ? ie. va ts. Ly Verify the amounts before posting to chart of accounts When you scroll to the bottom of the list box on the Windows form, you will see grand totals at the bottom. This is a convenience that tells the user if the debits and credits are equal (in balance and ready for posting to Chart Of Accounts). See the following figure 6, 4. "CD Ledgers Maintenance - o xX INTEREST EXPENSE (GL_DESCREPTION2 GE_DESCRIPTION2 Gr_pescarerions GL_DESCAEPTIONS Figure 6 Post the displayed amounts in the list box to chart of accounts The last step is to post the amounts from the list box on the Windows form to Chart Of Accounts. Click the button, “Append The Displayed Amounts To Their Ledgers”, to perform this task (see Figure 7). hip iwwn:.c-sharpcomer.conVUploadFile!87864/C-Sharp-code-for-making-2-double-entry-generaledger-posting-mv sons (CH Code For Making A Double Entry General Ledger Posting - Method 2 OFFICE SUFELTES (A) ran Te abe A Gott Ars Ed Fer Te td GL — a ‘Popend The Disolayed Amounts To Ther Ledgers The code for this operation is shown here: a. e2. a. ea. es. 25. er. 28. es. 10. a a 3. 1a. 15. 16. 17. a8. co 20. a 2. 2. 2a. 25. 26. 27. hip lwwn:.c-sharpcomer.conVUploadFile!876864/C-Sharp-code-or private void PostTochartofaccounts(object sender, EventArgs e) q // declare local variables. string stringAutoNumber, strfile orig, transaction_str; ‘long autonun vars char{] charval_auto_nunber = new char[3]3 charf] put_in_orig ledger, charval_tranaction; // get current working directory. currdir = Directory.GetCurrentbirectory(); curedir = currdir.Substring(@, currdir.Length - 9); result = MessageBox.Show("Do you want to proceed with this permanent double entry posting if (result { Dialogresult.Yes) Cursor.Current = new Cursor(currdin + "Busy_1.cu J] auto generate the next general ledger transaction number in sequence // to be included with the permananet general ledger postings to be used “1 for future operations and save this in a small data file, ‘autonunber.txt'. StreamReader streanobj3 = new StreanReader(currdin + “autonumber.txt"); streanobj3.BaseStrean.Seck(®, SeekOrigin. Begin); stringutoNlunber = streanodj3.ReadLine(); streanobj3.Close(); for (a = 5 a < 35 a4) € convert to_nunber(a] = 0; Af (stringAutoNunber.Substring(a, Af (stringautoNunber. Substring(a, Af (stringautoNumber.Substring(a, Af (stringautoNumber. Substring(a, Af (stringautoNumber.Substring(a, Af (stringautoNunber Substring(a, Af (stringautoNumber.Substring(a, Af (stringautoNumber Substring(a, Af (stringautoNumber. Substring(a, convert_to_number[a] convert_to_runber[a] convert_to_number{a] convert_to_number[a] = 3; convert_te_number[a] = 4; convert_to_number[a] = $3 convert_to_number[a] = 6; convert_te_number[a] = 7; convert_to_number[a] = 8; ne sisv2017 105, 108 107 os 109 he a1 a2 43 aa has us (CH Code For Making A Double Entry General Ledger Posting - Method 2 autonum_vars+s #COMm€l(autonum_var > 999) ASK A QUESTION t x for (a = @; a < 35 a+) charVal_auto_nunber[a] = (char)48; countervar = do € autonum_var longresult = Math.DivRem(autonum_var, 18, out long2); autonun_var = longresult; Sf (long? =~ 8) charVal_auto_nunber{countervar] = (char)4as if (long2 == 1) charVal_auto_number[countervar] = (char)49; Sf (long? == 2) charVal_autenunber{countervar] = (char)s@s if (long2 == 3) charVal_auto_nunber{ countervar] = (char)53; Af (long2 == 4) charval_auto_nunber[countervar] = (char)523 if (long2 == 5) charVal_auto_nunber{countervar] = (char)53; Af (longa == 6) charval_auto_nunber[countervar] = (char)54; if (longa == 7) charVal_auto_nunber{countervar] = (char)55; if (long2 == 8) charval_auto_nunber{ countervar] = (char)$6; Af (long? == 9) charVal_auto_number[countervar] = (char)573 countervar--; } while (autonum var > 8); Af (File.Exists(currdir + “autonunber.txt")) « x FileStream fstreanobj2 = new FileStrean(currdir + “autonunber.txt", FileMode.Create); Streamhriter writerobj2 = new Streaniiriter(fstreancbj2); weiterobj2.WriteLine(charval_auto_nunber); writerobj2.Close(); Fstreamodj2.Close(); File.Delete(currdir + “autonunber.txt"); // open a file strean to the Chart OF Accounts data file for 7] subsequent read operations. FileInfo datafileinfo = new FileInfo(currdir + “mastcoa. txt"); sizeofdatafile = datafileinfo. Length; StreanReader streanobj = new StreanReader(currdir + “nastcoa. txt"); streanobj .BaseStrean.Seek(@, SeckOrigin. Begin); // open a file stream to the supplenental cash disburserent: 1] ‘cd ledger. txt", for subsequent read operations. FileInfo datafileinfo_auxiliary = new FileInfo(currdir + “cd_ledger.txt"); sizeofdatafile_auxiliary = datafileinfo_auxiliary.Length; StreanReader streanobj_auxiliary = new StrearReader(currdir + “cd_ledger. txt"); data file, /| initialize the Chart OF Accounts data file offset to @. datafileoffset = 0; do « J/ ead the next sequential record fron the Chart Of Accounts data file. stringVal = streanobj.ReadLine(); // extract the transient general ledger file nane fron the UNTRIBUTE W/ Chart OF Accounts record and assign it to the transient general ledger 1/ filename, ‘strfile_tenp' strfile_tenp = stringVal.Substring(4s, 8); strfile_tenp = strfile_tenp + "_.txt") 1/ extract the permanest general ledger file nane fron the just read J/ Chart OF Accounts record and assign it to the permanent general ledger 1/ filename, ‘strfile orig strfile_orig = stringVal.Substring(4s, 8); strffle_orig = strfile_orig + "txt"; hip lwwn.c-sharpcomer.conVUploadFile!87864IC-Sharp-code-fr-making-e-double-entry-general-ledger-posting-m sane sisv2017 é #Corner. 23 124, as 126 7 128 129 132 131 a 133 a 135 136 137 138 be ase aan aaa 143 aa, as 1s a7 las 14g ise 151 182 153 asa 4355 156 47 18 159 16@ 162 162 163 64, 165, 166 167 168 169 ae a7 a7 3 174 as 176 7 178 179 ee 181 ea 183 18a 185 a6 187 188 is9 19e J/ An the Windows form and set calc_flag = 05 af { (CH Code For Making A Double Entry General Ledger Posting - Method 2 (stringval cale_flag (stringval. cale_flag (stringval. cale_flag (stringval. cale_flag (stringval. cale_flag (stringval. cale_flag (stringval. cale_flag (stringval. cale_flag (stringval. cale_flag (stringval cale_flag (stringval. cale_flag (stringval. cale_flag (stringval. cale_flag (stringval. cale_flag (stringval. cale_flag (stringval. cale_flag (stringval. cale_flag ASK A QUESTION Substring(41, 4) == "1900") 2b Substring(41, 4) == "1610") ub Substring(41, “1e00") Substring(41, "1070") Substring(41, "1080" ui Substring(41, 4) == "2100") a Substring(41, "2n20") substring(42, "2120") substring(42, “2160") au Substring(4i, 4) == 2210") =u Substring(41, 4) == "2400") Substring(41, "3030") Substring(41, “a200") Substring(41, 4) == "4100") =u Substring(41, 4) =» "se00") Substring(41, 6500") Substring(41, "7300") 4 matching it. htiplww.c-sharpomer.con/UplosdFle!87864/0-Sharp-code-formaking-s-double-entry-general-ledger-posting-m 139 sisv2017 (CH Code For Making A Double Entry General Ledger Posting - Method 2 4#Comer le (stetngvel.subseringcas, 4) ASK QUESTION ‘ise! < 197 cale_flag = 1; 198. } 199 if (steingval .substring(ai, 4) == "s30@") 200 201 eale_flag = 25 202 + 203 if (steingval.substring(ai, 4) «= "2100") 204, 205, cale_#lag 206 } 297 208 209) J/ attempt to match the general ledger # of the current record from the Chart OF ne 7/ Accounts to any of the general ledger #'s in the supplemental cash disbursenent zt 1/ data File, and set a flag, ‘calc flag", upon matching it. nz Sstreanobj_auxiliary.Basestrean.Seek(@, SeekOnigin. Begin); 23 datafileoffset_auxiliary = 6; nia do 215 t 16 217 stringVal_auxillary « streanobj_auxiliary.ReadLine(); 218. nis) Af (stringval.Substring(a1, 4) == stringval_auxiliary.Substeing(@, 4)) 220 221 calc flag = 15 222 auxiliary _ledger_count++ 223 > 224 225; datafileotfsct_auxiliary = datarileotfset_auxiliary + GLAUXILIARYs 226 227 } while (datafileoffset_auxiliary < sizeofdatafile auxiliary); 228 229 230 231 J/ Xf the general ledger # of the current record from the Chart OF 232 7/ Recounts has been matched and the transient general ledger file, 233 1/ ‘strfile temp", does exist, then proceed. 234. if (calc flag == 1 && File.xists(currdir + strfile_temp)) 235, < 236. 237) 238 239) J] open a Fite steean to the transient general ledger file, 240) 1/ ‘strfile_tenp', for subsequent read operations. aa FileInfo datafileinfo2 = new Fileinfo(currdir + strfile_temp); 242 sizeofdatafite2 « datafileinfo2.Length; 243. StreanReader strearobj2 = new StreanReader(currdir + strfile_tenp); 24a streanobj2.BaseStrean.Seek(®, SeekOrigin. Begin) ; 245, 246 // initialize the transient general ledger filenane, ‘strfile_tenp', offset to 247 datafileotfset2 = &; 24s. ao 249) f 250 251 252. // read a sequential record fron the transient general ledger data file. 253 stringval = streanobj2.ReadLine(); 254 255; 256 1/ Af there are a debit and/or credit amount(s) in the ‘stringVal’ variabl: 257 1/ then proceed with appending the anount(s) to the permanent general ledgi 258 11 data file. 259) if (Stringval.substring(5@, 1@) =" " [| stringval substring(6@, 260 ‘ 261. 262 283. // set the transaction description to ‘CD Transaction’ and convert 264 7/ character array. assign the current recoré fron the transient ¢ hip lwwn.c-sharpcomer.conVUploadFile!87864IC-Sharp-code-fr-making-e-double-entry-general-ledger-posting-m sans sisv2017 % 27 272 273 274, 275 276 277 278 279 20 281 282 283 284 285 286 287 288 289 298 29 292 293 294, 295, 296 297 298 298 300 301 302 303 304 305 306 307 308 309 318 311 312 313 314 315 316 317 318 319 322 322 322 323 324, 325, 326 327 328 329 330 331 332 333 334 335 336 337 338 #Corner (CH Code For Making A Double Entry General Ledger Posting - Method 2 1t_in_orig_ledger - stringval Length); , Sesser ASKA QUESTION eens /1 clear out the character array usea ror tne posting operation to the // general ledger data file. for (a = @; a < GLDETAILEN - 2; a++) recordatavar_transactions[a] = (ci J/ assign record from the transient general ledger data file to the // ‘recordatavar_transactions’ character array as well as ‘CO" for U1 the transaction type and the transaction description and also the W/ auto generated transaction nunber. for (2 = 0; a < stringVal.Length; a+) recordatavar_transactions[a] = | recordatavar_transactions[8] = "C's recordatavar_transactions[9] = ‘D' for (a = 0; a < transaction_str.Length; att) recordatavar_transactions for (2 = 0; a < 3; ast) recordatavar_transactions[a + 78] = charVal_aw /I append the above mentioned data in the ‘recordatavar_transactions’ + // to the permanent general ledger file. FileStream fstreanobji = new Filestrean(curndir + strfile_onig, FileMo: Streankriter writerobja = new StreanWriter(fstreanob j2); writerobj1.WriteLine(recordatavar_ transactions: writerobj1.Close(); Fstreanobji.Close(); // advance the supplemental cash disbursements data file offset forward by 1/ record to the next sequentially located record. datafileoffset2 = datafileoffset2 + GLDETAILEN; } while (datafileoffset2 < sizeofdatafile2); // close the file stream for the transient general ledger data file. streanobj2.Close(); // Xf the transient general ledger data file exists, /1 then get rid of it since it is no longer needed. Af (File-Exists(curedir + str#ile_tenp)) File.Delete(currdir + strfile_temp); J/ advance the Chart OF Accounts data file offset forward by one J/ vecord to the next sequentially located record. datafileoffset = datafileoffset + GLMASTERLEN; } while (datafileoffset < sizeofdatafile); 7/ Close the file stream for the supplenental cash disbursenents data file. streanobj_euxiliary.Close(); 1] close the Chart GF Accounts data file stream. streanobj .Close(); // 4£ the supplenental cash disbursements data file exists, then // get rid of it and recreate a new one with a blank record. Af (File.Exists(currdir + "ca_ledger.txt")) « File.Delete(currdir + "cd_ledger.txt"); hip lwwn.c-sharpcomer.conVUploadFile!87864IC-Sharp-code-fr-making-e-double-entry-general-ledger-posting-m 159 sisv2017 (CH Code For Making A Double Entry General Ledger Posting - Method 2 Streanriter writerobj_auxiliar ~ amobj_auxiliary); & 4 COMMEr weiterobj_auxiliary.Writetine(r weiterobj_auxiliary.Close(); Bas fstreanobj_auxiliary.Close(); 346 3a7 } 348 349 350 351 // repaint the Windows form to reflect the changes. 352 UpdateListing(); 383 asa 355, 356 Cursor.current = Cursors.Default; 357 388 359 » 36e 362 362. | } Conclusion Although my first method worked well and | thought it was relatively easy to use, it still wasn't acceptable to the customer. | have spent years learning this reality. That's why it is always important to listen to what customers really want and cater to that want with software that will keep them happy. Just because something looks good on the drawing board doesn't necessarily guarantee people will be satisfied with it, even if it does work correctly. Most people don't realize just how subjective this business can be - it isn't like going out and selling 10,000 widgets. That's why it’s called custom software, Download 100% FREE Spire Office APIs Accounts C#) | Chart Of Accounts | | Double Entry General Ledger Posting | | Ledger Posting Douglas Miller 70P 500 —_——— PAIGESEYNNE] | perform PC troubleshooting chores such as data recovery of files/folders from crashed ‘owmmmumr hard drives. | also replace bad hard drives and recover files/folders from them. | replace power supplies and add memory modules to ... Read more http://www.c-sharpcorner.com/members/douglas-miller 463 279.6k 1 ©) Type your comment here and press Enter Key (Minimum 18 characters) Thank you....'™m glad you like it Douglas Miller Dec 04, 2015 463 25k 279.6k 0 0 Reply Good one Santhakumar Munuswamy Dec ou hip lwwn.c-sharpcomer.conVUploadFile!87864IC-Sharp-code-fr-making-e-double-entry-general-ledger-posting-m 169 aior2017 (CH Cade For Making A Double Entry General Ledger Posting - Method 2 FC uComer “ Good Share Mukesh Kumar bec 04,2015 87 147k 24m 00 Reply nice Mohammed Ibrahim bec 03,2015 Comment Using 0. Comments Sort by | Oldest Add a comment. Facebook Comments Plugin File APIs for NET (al W= spose are the market leader of NET APIs for file business formats - natively work with DOCK, XLSX, PPT, PDF, MSG, MPP, images formats and many more! Progress’ Build Your ASP.NET Web Forms Apps Faster_with UI for ASP.NET AJAX aan TRENDING UP 01. Multithreading in C# Net 02. Best Practices For MVC 03 What Is Big Data? 04. How To Use Joins, and Group By Clause In Entity Framework With LINQ C# hip lwwn.c-sharpcomer.conVUploadFile!87864IC-Sharp-code-fr-making-e-double-entry-general-ledger-posting-m 429 29k 281.6k 0 0 Reply ans aior2017 (CH Cade For Making A Double Entry General Ledger Posting - Method 2 O64 Cceatipg Web,fPl With ASP.NET Core Using Vist aN 07 Future Of loT, Machine Learning, And Artificial intelligence 08 Project Server 2013 Migration From One Farm To Another 09 Creating A Database-Driven MVC Image Gallery With Thumbnails, 10. Learn MVC:: Using Angular PDF File Viewer View All O 6.4K followers ROTH aac Lkele k oy Build: Your ASP.NET Web Forms Vey osM em b UI for ASP.NET AJAX aia JOIN C# CORNER hip lwwn.c-sharpcomer.conVUploadFile!87864IC-Sharp-code-fr-making-e-double-entry-general-ledger-posting-m sane sisv2017 (CH Code For Making A Double Entry General Ledger Posting - Method 2 - seis your Cinna wuss bees = % ctco¢ne 4 ASK A QUESTION me os ©2017 C#t Corner. ll contents are copyright of their authors. hip lwwn.c-sharpcomer.conVUploadFile!87864IC-Sharp-code-fr-making-e-double-entry-general-ledger-posting-m sens

You might also like