@@ -270,18 +270,50 @@ public static ArrayOfManualJournal loadManualJournal() throws IOException {
270
270
if (accountDirectCosts .size () == 0 ){
271
271
System .out .println ("no direct cost accounts" );
272
272
}
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 ();
273
284
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
+ }
274
304
275
305
ManualJournalLine debit = new ManualJournalLine ();
276
306
debit .setDescription ("My MJ Debit" );
277
307
debit .setAccountCode ("400" );
278
308
debit .setLineAmount (new BigDecimal (10.00 ));
309
+ debit .setTracking (arrayTracking );
279
310
arrayOfMJLine .getJournalLine ().add (debit );
280
311
281
312
ManualJournalLine credit = new ManualJournalLine ();
282
313
credit .setDescription ("My MJ Credit" );
283
314
credit .setAccountCode ("500" );
284
315
credit .setLineAmount (new BigDecimal (-10.00 ));
316
+ credit .setTracking (arrayTracking );
285
317
arrayOfMJLine .getJournalLine ().add (credit );
286
318
287
319
ManualJournal mj = new ManualJournal ();
0 commit comments