EndSubCheck() public method

Marks the specified subcheck as complete, only if it's fully paid. Also sends the order to the kitchen if it has not been printed yet.
public EndSubCheck ( Context context, long invoiceNumber, short subCheckNumber ) : bool
context Context The store id, station id, and cashier id the information should be restricted to.
invoiceNumber long The number of the invoice that should be ended
subCheckNumber short The number for the subcheck to be ended
return bool
        static void TestSplits()
        {
            try
            {
                SalesAPI api = new SalesAPI();

                pcAmerica.DesktopPOS.API.Client.SalesService.Context context = new pcAmerica.DesktopPOS.API.Client.SalesService.Context();
                context.CashierID = "100101";
                context.StoreID = "1001";
                context.StationID = "01";

                Invoice inv = api.StartNewInvoice(context, "Rich", "XXOPEN TABS");
                api.LockInvoice(context, inv.InvoiceNumber);
                inv.LineItems.Add(new LineItem() { Id = Guid.NewGuid(), ItemName = "TRIPPLE CHEESE BURGER", ItemNumber = "SAND4", Price = 3.99M, Quantity = 3, State = EntityState.Added, Guest = "1" });
                api.ModifyItems(context, inv.InvoiceNumber, inv.LineItems);
                api.UnLockInvoice(context, inv.InvoiceNumber);

                inv = api.SplitInvoice(context, inv.InvoiceNumber, 3);

                for (int i = 0; i <= inv.SplitInfo.NumberOfSplitChecks - 1; i++)
                {
                    Console.WriteLine(String.Format("Rich - Guest #{0}: ${1}", i + 1, inv.SplitInfo.GrandTotalForSplit[i]));
                }

                inv = api.StartNewInvoice(context, "Steve", "XXOPEN TABS");
                api.SetPartySizeForInvoice(context, inv.InvoiceNumber, 3);
                api.LockInvoice(context, inv.InvoiceNumber);
                inv.LineItems.Add(new LineItem() { Id = Guid.NewGuid(), ItemName = "TRIPPLE CHEESE BURGER", ItemNumber = "SAND4", Price = 3.99M, Quantity = 1, State = EntityState.Added, Guest = "1" });
                inv.LineItems.Add(new LineItem() { Id = Guid.NewGuid(), ItemName = "TRIPPLE CHEESE BURGER", ItemNumber = "SAND4", Price = 3.99M, Quantity = 1, State = EntityState.Added, Guest = "2" });
                inv.LineItems.Add(new LineItem() { Id = Guid.NewGuid(), ItemName = "TRIPPLE CHEESE BURGER", ItemNumber = "SAND4", Price = 3.99M, Quantity = 1, State = EntityState.Added, Guest = "3" });
                api.ModifyItems(context, inv.InvoiceNumber, inv.LineItems);
                api.UnLockInvoice(context, inv.InvoiceNumber);

                inv = api.SplitInvoice(context, inv.InvoiceNumber, 3);

                api.ApplyCashPayment(context, inv.InvoiceNumber, 1, 2.00M);
                api.ApplyCashPayment(context, inv.InvoiceNumber, 2, 50.00M);
                //updates the split information so it has the payment info
                inv = api.GetInvoiceHeader(context, inv.InvoiceNumber);
                // shows split info grand total and if it is completly paid
                // NOTE: Even if you have fully paid a sub check it won't be marked as paid until you run EndSubCheck on it
                for (int i = 0; i <= inv.SplitInfo.NumberOfSplitChecks - 1; i++)
                {
                    Console.WriteLine(String.Format("Steve -  Grand Total SPLIT #{0}: ${1}", i + 1, inv.SplitInfo.GrandTotalForSplit[i]));
                    Console.WriteLine(String.Format("Steve -  Paid SPLIT #{0}: {1}", i + 1, inv.SplitInfo.IsSplitPaid[i]));
                }
                api.EndSubCheck(context, inv.InvoiceNumber, 2);
                inv = api.GetInvoiceHeader(context, inv.InvoiceNumber);
                for (int i = 0; i <= inv.SplitInfo.NumberOfSplitChecks - 1; i++)
                {
                    Console.WriteLine(String.Format("Steve -  Grand Total SPLIT #{0}: ${1}", i + 1, inv.SplitInfo.GrandTotalForSplit[i]));
                    Console.WriteLine(String.Format("Steve -  Paid SPLIT #{0}: {1}", i + 1, inv.SplitInfo.IsSplitPaid[i]));
                }
            }
            finally
            {
                Console.WriteLine("PRESS ENTER TO CONTINUE...");
                Console.ReadLine();
            }
        }