@@ -270,18 +270,50 @@ public static ArrayOfManualJournal loadManualJournal() throws IOException {
270270 if (accountDirectCosts .size () == 0 ){
271271 System .out .println ("no direct cost accounts" );
272272 }
273+
274+ // GET ALL YOUR TRACKING CATEGORIES
275+ List <TrackingCategory > TrackingCategoryList = client .getTrackingCategories ();
276+
277+ // Create a New Array to Populate with a chosen Tracking Category
278+ ArrayOfTrackingCategory arrayTracking = new ArrayOfTrackingCategory ();
279+
280+ if (TrackingCategoryList .size () > 0 ) {
281+ // Get the options for a Tracking Category 1
282+ ArrayOfTrackingCategoryOption options1 = TrackingCategoryList .get (0 ).getOptions ();
283+ List <TrackingCategoryOption > optionList1 = options1 .getOption ();
273284
285+ // Populate the option 1 with the Name of the Cateogry and Option
286+ TrackingCategory category1 = new TrackingCategory ();
287+ category1 .setName (TrackingCategoryList .get (0 ).getName ());
288+ category1 .setOption (optionList1 .get (0 ).getName ());
289+
290+ arrayTracking .getTrackingCategory ().add (category1 );
291+
292+ // Get the options for a Tracking Category 2
293+ ArrayOfTrackingCategoryOption options2 = TrackingCategoryList .get (1 ).getOptions ();
294+ List <TrackingCategoryOption > optionList2 = options2 .getOption ();
295+
296+ // Populate the option 2 with the Name of the Cateogry and Option
297+ TrackingCategory category2 = new TrackingCategory ();
298+ category2 .setName (TrackingCategoryList .get (1 ).getName ());
299+ category2 .setOption (optionList2 .get (1 ).getName ());
300+
301+ arrayTracking .getTrackingCategory ().add (category2 );
302+
303+ }
274304
275305 ManualJournalLine debit = new ManualJournalLine ();
276306 debit .setDescription ("My MJ Debit" );
277307 debit .setAccountCode ("400" );
278308 debit .setLineAmount (new BigDecimal (10.00 ));
309+ debit .setTracking (arrayTracking );
279310 arrayOfMJLine .getJournalLine ().add (debit );
280311
281312 ManualJournalLine credit = new ManualJournalLine ();
282313 credit .setDescription ("My MJ Credit" );
283314 credit .setAccountCode ("500" );
284315 credit .setLineAmount (new BigDecimal (-10.00 ));
316+ credit .setTracking (arrayTracking );
285317 arrayOfMJLine .getJournalLine ().add (credit );
286318
287319 ManualJournal mj = new ManualJournal ();
0 commit comments