Example #1
0
 /// <summary>
 /// Displays items as per given item id as well as no of rows to be displayed.
 /// </summary>
 /// <param name="howManyRows"></param>
 /// <param name="selectedItemID"></param>
 /// <returns></returns>
 public DialogResult ItemSearch(int howManyRows, ref string selectedItemID)
 {
     using (frmItemSearch itemSearch = new frmItemSearch(howManyRows))
     {
         LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(itemSearch);
         selectedItemID = itemSearch.SelectedItemId;
         return(itemSearch.DialogResult);
     }
 }
        private void _grid_CellButtonClick(object sender, RowColEventArgs e)
        {
            Cursor = Cursors.AppStarting;
            try
            {
                // open item list form
                if (e.Col == _grid.Cols["ItemCode"].SafeIndex)
                {
                    frmItemSearch fx;
                    if (_grid[e.Row, "ItemCode"] == DBNull.Value)
                    {
                        fx = new frmItemSearch();
                    }
                    else
                    {
                        fx = new frmItemSearch((int)_grid[e.Row, "ItemID"]);
                    }
                    fx.ShowDialog();

                    if (fx.SelectedOK)
                    {
                        dsCore.ItemsDataTable data = daItems1.GetDataByID(fx.SelectedID);
                        // item info
                        if (data.Rows.Count > 0)
                        {
                            // display data
                            _grid.SetData(e.Row, "ItemID", data[0].ID);
                            _grid.SetData(e.Row, "ItemCode", data[0].Code);
                            _grid.SetData(e.Row, "ItemName", data[0].Name);
                            _grid.SetData(e.Row, "MeasureCode", data[0].IsMeasureCodeNull() ? "" : data[0].MeasureCode);
                            _grid.SetData(e.Row, "UnitPrice", data[0].IsSellingPriceNull() ? 0 : data[0].SellingPrice);
                            _grid.SetData(e.Row, "TaxPct", 0);
                            _grid.SetData(e.Row, "TrxType", 0);
                            _grid.SetData(e.Row, "Quantity", 1);
                            // display default remark
                            _grid.SetData(e.Row, "Remarks", c1TextBox2.Text);
                        }
                    }
                }
                // Auto counting for kredit each time
                c1Label1.Value = CountDetails();
            }
            catch (Exception ex)
            {
                Logger.ErrorRoutine(ex);
                RibbonMessageBox.Show("ERROR Adding Detail Items: " + ex.Message,
                                      Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            Cursor = Cursors.Default;
        }
Example #3
0
        public DialogResult MyItemSearch(int howManyRows, ref string selectedItemID, out DataSet dsItemDetails, string condition = "")
        {
            using (frmItemSearch itemSearch = new frmItemSearch(howManyRows, condition, "O"))
            {
                dsItemDetails = new DataSet();
                DataTable dtItemDetails = new DataTable("dtItemDetails");
                dtItemDetails.Columns.Add("ITEMID", typeof(string));
                dtItemDetails.Columns.Add("ITEMNAME", typeof(string));
                dtItemDetails.Columns.Add("ITEMPRICE", typeof(string));
                DataRow drItem;

                LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(itemSearch);

                selectedItemID      = itemSearch.SelectedItemId;
                drItem              = dtItemDetails.NewRow();
                drItem["ITEMID"]    = itemSearch.SelectedItemId;
                drItem["ITEMNAME"]  = itemSearch.selectedItemName;
                drItem["ITEMPRICE"] = itemSearch.selectedItemPrice;
                dtItemDetails.Rows.Add(drItem);
                dsItemDetails.Tables.Add(dtItemDetails);
                return(itemSearch.DialogResult);
            }
        }