Пример #1
0
        private void menuItem3_Click(object sender, EventArgs e)
        {
            try
            {
                dt.Clear();

                Cursor.Current = Cursors.WaitCursor;
                StockTake stk = new StockTake(uname, staffdim, ulevel);
                stk.Show();
                dgGRNLine.DataSource = null;
                menuValue            = "2";
                txtBin.Enabled       = true;
                txtBin.Focus();

                CompactSQL comsql = new CompactSQL();
                getdata = comsql.SelectRecord("StockTakeEntry");
                GetSQLData(getdata);

                MessageBox.Show("You have choosen Opening Balance Option.");

                Cursor.Current = Cursors.Default;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error" + ex);
            }
        }
Пример #2
0
        private void menuItem1_Click(object sender, EventArgs e)
        {
            this.Close();
            StockTake stk = new StockTake(uname, staffdim, ulevel);

            stk.Show();
        }
Пример #3
0
        private void mnuDeleteAll_Click(object sender, EventArgs e)
        {
            CompactSQL comsql = new CompactSQL();

            comsql.deleteRecord("StockTakeEntry");
            this.Close();
            StockTake st = new StockTake(uname, staffdim, ulevel);

            st.Show();
        }
Пример #4
0
        private void pictureBox3_Click(object sender, EventArgs e)
        {
            //Location loc = new Location();
            //loc.Show();

            Cursor.Current = Cursors.WaitCursor;
            StockTake stk = new StockTake(usng, staffdimg, uslvelg);

            stk.Show();
            Cursor.Current = Cursors.Default;
        }
Пример #5
0
 private void ImportXMLToSQL()
 {
     Cursor.Current = Cursors.WaitCursor;
     try
     {
         CompactSQL comsql          = new CompactSQL();
         string     ApplicationPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
         ApplicationPath = ApplicationPath + "\\Stocktake.xml";
         if (File.Exists(ApplicationPath))
         {
             var result = MessageBox.Show("Are you sure to replace current data?", "Confirmation",
                                          MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
             if (result == DialogResult.Yes)
             {
                 comsql.deleteRecord("StockTakeEntry");
                 //XMl to SQL
                 DataSet ds = new DataSet();
                 ds.ReadXml(ApplicationPath);
                 foreach (DataRow dRow in ds.Tables[0].Rows)
                 {
                     object[] array = new object[7];
                     array[0] = dRow["ItemNo"].ToString();
                     array[1] = dRow["BinCode"].ToString();
                     array[2] = dRow["Quantity"].ToString();
                     array[3] = dRow["PostDate"].ToString();
                     array[4] = dRow["StaffName"].ToString();
                     array[5] = dRow["Category"].ToString();
                     array[6] = dRow["Loc"].ToString();
                     dt.Rows.Add(array);
                     comsql.InsertRecord("StockTakeEntry", array);
                 }
                 // this.Close();
                 MessageBox.Show("Restore Successfully");
                 StockTake St = new StockTake(uname, staffdim, ulevel);
                 St.Show();
             }
         }
         else
         {
             MessageBox.Show("Nothing to restore data");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     Cursor.Current = Cursors.Default;
 }
Пример #6
0
        private void menuItem4_Click(object sender, EventArgs e)
        {
            try
            {
                dt.Clear();

                Cursor.Current = Cursors.WaitCursor;
                StockTake stk = new StockTake(uname, staffdim, ulevel);
                stk.Show();
                dgGRNLine.DataSource = null;
                menuValue            = "1";
                txtBin.Enabled       = true;
                txtBin.Focus();
                MessageBox.Show("You have choosen Stock Take Option.");
                Cursor.Current = Cursors.Default;
            }catch (Exception ex)
            {
                MessageBox.Show("Error" + ex);
            }
        }
Пример #7
0
        private void MnuNewGRN_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgGRNLine.DataSource == null)
                {
                    MessageBox.Show("Please scan the item first!");
                }
                else
                {
                    Cursor.Current = Cursors.WaitCursor;

                    try
                    {
                        qhStockTakeWS.StockTakeWS_Service qhserv = new QHMobile.qhStockTakeWS.StockTakeWS_Service();
                        qhserv.Url         = WebServiceInstants.GetURL(ServiceType.StockTakeWS);
                        qhserv.Credentials = nc;

                        CurrencyManager cm = (CurrencyManager)this.BindingContext[dgGRNLine.DataSource];
                        DataView        dv = (DataView)cm.List;
                        //qhStockTakeWS.StockTakeWS[] stock_list = new qhStockTakeWS.StockTakeWS[stmod.Count];
                        qhStockTakeWS.StockTakeWS[] stock_list = new qhStockTakeWS.StockTakeWS[dv.Count];

                        //qhStockTakeWS.StockTakeWS[] stock_all = qhserv.ReadMultiple(null, null, 0);
                        //linecount = stock_all.Count();


                        QH_Functions.QH_Functions qhfun = new QHMobile.QH_Functions.QH_Functions();
                        qhfun.Url         = WebServiceInstants.GetURL(ServiceType.QH_Functions);
                        qhfun.Credentials = nc;


                        for (int i = 0; i < dv.Count; i++)
                        {
                            qhStockTakeWS.StockTakeWS updatestock = new QHMobile.qhStockTakeWS.StockTakeWS();

                            updatestock.Stock_take_Code = "1";
                            updatestock.Item_No         = stmod[i].ItemNo;
                            //updatestock.Item_No = dgGRNLine[i, 0].ToString();


                            //  updatestock.Line_NoSpecified = true;

                            //linecount = qhfun.GetStockTakeLastLineNo();
                            // linecount = ++linecount;
                            //updatestock.Line_No = linecount;


                            updatestock.BinCode = stmod[i].binNo;
                            //updatestock.BinCode = dgGRNLine[i, 1].ToString();

                            updatestock.Stock_take_QuantitySpecified = true;
                            updatestock.Stock_take_Quantity          = stmod[i].qty;
                            //updatestock.Stock_take_Quantity = Convert.ToInt32(dgGRNLine[i, 2].ToString());
                            updatestock.Stock_take_DateSpecified = true;
                            updatestock.Stock_take_Date          = stmod[i].postDate;
                            //updatestock.Stock_take_Date = Convert.ToDateTime(dgGRNLine[i, 3].ToString());
                            updatestock.Staff_Dimension_Code = staffdim;
                            //updatestock.Staff_Dimension_Code = dgGRNLine[i, 4].ToString();
                            updatestock.Entry_DateSpecified = true;
                            updatestock.Entry_Date          = stmod[i].entryDate;
                            //updatestock.Entry_Date = Convert.ToDateTime(dgGRNLine[i, 5].ToString());
                            updatestock.Registered_DateSpecified = true;
                            updatestock.Registered_Date          = stmod[i].entryDate;
                            //updatestock.Registered_Date = Convert.ToDateTime(dgGRNLine[i, 5].ToString());


                            updatestock.Message = "Items not in Phys. Invty Jnl";
                            if (string.IsNullOrEmpty(txtLocation.Text.ToString()))
                            {
                                updatestock.Location_Code = "QH1";
                            }
                            else
                            {
                                updatestock.Location_Code = txtLocation.Text.ToString();
                            }

                            updatestock.Category = stmod[i].category;
                            //updatestock.Category = dgGRNLine[i, 6].ToString();

                            updatestock.Skip_Auto_NumberSpecified = false;
                            updatestock.Skip_Auto_Number          = false;
                            qhserv.Create(ref updatestock);
                            //stock_list[i] = updatestock;
                        }

                        //qhserv.CreateMultiple(ref stock_list);

                        CompactSQL comsql = new CompactSQL();
                        comsql.deleteRecord("StockTakeEntry");

                        Cursor.Current = Cursors.Default;

                        MessageBox.Show("Submitted!");
                        this.Close();
                        StockTake st = new StockTake(uname, staffdim, ulevel);
                        st.Show();
                    }
                    catch (Exception ex)
                    {
                        Cursor.Current = Cursors.Default;
                        MessageBox.Show("Error" + ex);
                    }
                }
            }catch (Exception ex)
            {
                MessageBox.Show("Error" + ex);
            }
        }
Пример #8
0
        private void MnuNewGRN_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgGRNLine.DataSource == null)
                {
                    MessageBox.Show("Please scan the item first!");
                }
                else
                {
                    Cursor.Current = Cursors.WaitCursor;

                    try
                    {
                        qhStockTakeWS.StockTakeWS_Service qhserv = new QHMobile.qhStockTakeWS.StockTakeWS_Service();
                        qhserv.Url         = WebServiceInstants.GetURL(ServiceType.StockTakeWS);
                        qhserv.Credentials = nc;

                        CurrencyManager             cm         = (CurrencyManager)this.BindingContext[dgGRNLine.DataSource];
                        DataView                    dv         = (DataView)cm.List;
                        qhStockTakeWS.StockTakeWS[] stock_list = new qhStockTakeWS.StockTakeWS[dv.Count];

                        QH_Functions.QH_Functions qhfun = new QHMobile.QH_Functions.QH_Functions();
                        qhfun.Url         = WebServiceInstants.GetURL(ServiceType.QH_Functions);
                        qhfun.Credentials = nc;


                        for (int i = 0; i < dv.Count; i++)
                        {
                            qhStockTakeWS.StockTakeWS updatestock = new QHMobile.qhStockTakeWS.StockTakeWS();

                            updatestock.Stock_take_Code = "1";
                            updatestock.Item_No         = stmod[i].ItemNo;
                            updatestock.BinCode         = stmod[i].binNo;
                            updatestock.Stock_take_QuantitySpecified = true;
                            updatestock.Stock_take_Quantity          = stmod[i].qty;
                            updatestock.Stock_take_DateSpecified     = true;
                            updatestock.Stock_take_Date          = stmod[i].postDate;
                            updatestock.Staff_Dimension_Code     = staffdim;
                            updatestock.Entry_DateSpecified      = true;
                            updatestock.Entry_Date               = stmod[i].entryDate;
                            updatestock.Registered_DateSpecified = true;
                            updatestock.Registered_Date          = stmod[i].entryDate;
                            updatestock.Message                   = "Items not in Phys. Invty Jnl";
                            updatestock.Location_Code             = stmod[i].loc;
                            updatestock.Category                  = stmod[i].category;
                            updatestock.Skip_Auto_NumberSpecified = false;
                            updatestock.Skip_Auto_Number          = false;
                            qhserv.Create(ref updatestock);
                            //deleteRecordLine
                            CompactSQL comsql = new CompactSQL();
                            comsql.deleteRecordLine("StockTakeEntry", stmod[i].lineno);
                        }

                        //qhserv.CreateMultiple(ref stock_list);

                        //CompactSQL comsql = new CompactSQL();
                        //comsql.deleteRecord("StockTakeEntry");

                        Cursor.Current = Cursors.Default;

                        MessageBox.Show("Submitted!");
                        this.Close();
                        StockTake st = new StockTake(uname, staffdim, ulevel);
                        st.Show();
                    }
                    catch (Exception ex)
                    {
                        Cursor.Current = Cursors.Default;
                        MessageBox.Show("Error" + ex);
                        this.Close();
                        StockTake st = new StockTake(uname, staffdim, ulevel);
                        st.Show();
                    }
                }
            }catch (Exception ex)
            {
                MessageBox.Show("Error" + ex);
            }
        }