private void addItem()
        {
            MSelectedItem si = new MSelectedItem(new CTable(""));

            si.SelectionType = "2";
            si.ItemObj       = null;
            si.EnabledFlag   = "Y";
            si.ItemQuantity  = "1";

            billSim.AddSelectedItem(si);
            billSim.IsModified = true;
        }
        private void populateBillSimulate(MAccountDoc doc)
        {
            MBillSimulate bs = doc.BillSimulate;

            bs.ClearSelectedItem();

            bs.DocumentDate   = doc.DocumentDate;
            bs.SimulateTime   = doc.DocumentDate;
            bs.CustomerObj    = doc.CustomerObj;
            bs.CustomerID     = doc.EntityId;
            bs.BranchId       = doc.BranchId;
            bs.DocumentType   = doc.DocumentType;
            bs.DocumentStatus = doc.DocumentStatus;

            foreach (MAccountDocItem di in doc.AccountItem)
            {
                if (di.ExtFlag.Equals("D"))
                {
                    continue;
                }

                MSelectedItem si = new MSelectedItem(new CTable(""));

                si.TrayFlag = "N";
                if (di.IsTrayFlag == true)
                {
                    si.TrayFlag = "Y";
                }

                si.SelectionType            = di.SelectType;
                si.ServiceID                = di.ServiceID;
                si.ItemID                   = di.ItemId;
                si.ServiceCode              = di.ServiceCode;
                si.ServiceName              = di.ServiceName;
                si.ItemCode                 = di.ItemCode;
                si.ItemNameThai             = di.ItemNameThai;
                si.ItemQuantity             = di.Quantity;
                si.ItemCategory             = di.ItemCategory;
                si.ServicePricingDefinition = di.ServicePricingDefinition;
                si.PricingDefination        = di.PricingDefinition;
                si.EnabledFlag              = "Y";

                bs.AddSelectedItem(si);
            }
        }