Ejemplo n.º 1
0
        private void deleteCurrentRow()
        {
            bool isFound = false;

            if (tableJournal.Rows.Count > 0)
            {
                for (int i = 0; i < tableJournal.Rows.Count; i++)
                {
                    ///thurein
                    if ((tableJournal.Rows[i][0].ToString() == GrdTO[GrdTO.CurrentCell.RowNumber, 0].ToString()) && (tableJournal.Rows[i][1].ToString() == GrdTO[GrdTO.CurrentCell.RowNumber, 1].ToString()) && (tableJournal.Rows[i][2].ToString() == GrdTO[GrdTO.CurrentCell.RowNumber, 2].ToString()) && !isFound)
                    {
                        //subtract from summary table
                        //CalculateSummaryTable(dg_stock[dg_stock.CurrentCell.RowNumber, 0].ToString(), dg_stock[dg_stock.CurrentCell.RowNumber, 1].ToString(), "-" + dg_stock[dg_stock.CurrentCell.RowNumber, 2].ToString(), dg_stock[dg_stock.CurrentCell.RowNumber, 3].ToString());
                        // DeleteToSummaryTable(GrdAddline[GrdAddline.CurrentCell.RowNumber, 0].ToString(), GrdAddline[GrdAddline.CurrentCell.RowNumber, 1].ToString(), "-" + GrdAddline[GrdAddline.CurrentCell.RowNumber, 2].ToString(), GrdAddline[GrdAddline.CurrentCell.RowNumber, 3].ToString());
                        //addToSummaryTable(dg_stock[dg_stock.CurrentCell.RowNumber, 0].ToString(), dg_stock[dg_stock.CurrentCell.RowNumber, 1].ToString(), "-" + dg_stock[dg_stock.CurrentCell.RowNumber, 2].ToString());

                        CompactSQL comsql = new CompactSQL();
                        comsql.deleteRecordLine("ItemReclass", Convert.ToInt32(GrdTO[GrdTO.CurrentCell.RowNumber, 7].ToString().Trim()));
                        tableJournal.Rows.RemoveAt(i);
                        //string aaaaa = GrdTO[GrdTO.CurrentCell.RowNumber, 7].ToString();
                        journalarray.RemoveAt(i);
                        isFound = true;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public PurChaseOrder(string vname, string vno, string usng, string staffdimg, string uslvelg)
        {
            InitializeComponent();
            PoArray.Clear();
            dt.Clear();

            vNumber         = vno;
            vName           = vname;
            vuser           = usng;
            vstaffdimension = staffdimg;
            vstafflevel     = uslvelg;

            txtVendorNo.Text   = vNumber;
            txtVendorName.Text = vName;
            txtRegDate.Text    = DateTime.Now.ToString("dd/MM/yyyy");
            txtLocation.Text   = "QH1";

            dt.Columns.Add("Item No");
            dt.Columns.Add("Item Description");
            dt.Columns.Add("Location");
            dt.Columns.Add("Quantity");
            dt.Columns.Add("LineNo");

            txtItemNo.Focus();

            //load from SQL
            //
            CompactSQL comsql = new CompactSQL();

            getdata = comsql.SelectRecord("PurchaseOrder");
            GetSQLData(getdata, false);
        }
Ejemplo n.º 3
0
        public StockTake(string username, string staffdim, string userlevel)
        {
            InitializeComponent();
            stmod = new List <QHMobile.App_Data.STModule>();
            stmod.Clear();
            dt = new DataTable("ST_Table");
            dt.Clear();
            dt.Rows.Clear();

            dgGRNLine.DataSource = null;
            dgGRNLine.Refresh();

            dt.Columns.Add(new DataColumn("ItemNo"));
            dt.Columns.Add(new DataColumn("BinNo"));
            dt.Columns.Add(new DataColumn("Qty"));
            dt.Columns.Add(new DataColumn("Posting_Date"));     // Stock take date
            dt.Columns.Add(new DataColumn("Staff_Name"));
            //dt.Columns.Add(new DataColumn("Entry_Date"));
            dt.Columns.Add(new DataColumn("Category"));
            dt.Columns.Add(new DataColumn("Lineno"));
            //txtBin.Focus();
            this.staffdim = staffdim;
            this.uname    = username;
            this.ulevel   = userlevel;

            CompactSQL comsql = new CompactSQL();

            getdata = comsql.SelectRecord("StockTakeEntry");
            GetSQLData(getdata);
        }
Ejemplo n.º 4
0
        private void deleteCurrentRow()
        {
            bool isFound = false;

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    //if ((dt.Rows[i][0].ToString() == GrdDailyLoss[GrdDailyLoss.CurrentCell.RowNumber, 0].ToString()) &&
                    //    (dt.Rows[i][1].ToString() == GrdDailyLoss[GrdDailyLoss.CurrentCell.RowNumber, 1].ToString()) &&
                    //    (dt.Rows[i][2].ToString() == GrdDailyLoss[GrdDailyLoss.CurrentCell.RowNumber, 2].ToString()) &&
                    //    (dt.Rows[i][3].ToString() == GrdDailyLoss[GrdDailyLoss.CurrentCell.RowNumber, 3].ToString()) &&
                    //    (dt.Rows[i][5].ToString() == GrdDailyLoss[GrdDailyLoss.CurrentCell.RowNumber, 4].ToString()) &&
                    //    !isFound)
                    if ((dt.Rows[i][6].ToString() == GrdDailyLoss[GrdDailyLoss.CurrentCell.RowNumber, 6].ToString()) &&
                        !isFound)
                    {
                        CompactSQL comsql = new CompactSQL();
                        comsql.deleteRecordLine("DailyLoss", Convert.ToInt32(GrdDailyLoss[GrdDailyLoss.CurrentCell.RowNumber, 6].ToString().Trim()));
                        dt.Rows.RemoveAt(i);
                        array_daily.RemoveAt(i);

                        getdata = comsql.SelectRecord("DailyLoss");
                        GetSQLData(getdata);

                        isFound = true;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        private void btnSaveUpdate_Click(object sender, EventArgs e)
        {
            array_daily[updatnumber].bincode  = txtEditBinCode.Text;
            array_daily[updatnumber].quantity = txtEditQty.Text;

            GrdDailyLoss.DataSource = null;
            dt.Clear();

            //for (int i = 0; i < array_daily.Count; i++)
            //{
            //    Object[] array = new Object[6];

            //    array[0] = array_daily[i].itemno;
            //    array[1] = array_daily[i].location;
            //    array[2] = array_daily[i].bincode;
            //    array[3] = array_daily[i].quantity;
            //    array[4] = array_daily[i].postingDate;
            //    array[5] = array_daily[i].staffdimension;

            //    dt.Rows.Add(array);

            //}

            CompactSQL comsql = new CompactSQL();

            comsql.updateDailyLoss(Convert.ToInt32(txtEditQty.Text.ToString()), Convert.ToInt32(txtLineNo.Text.ToString()));

            getdata = comsql.SelectRecord("DailyLoss");
            GetSQLData(getdata);

            //GrdDailyLoss.DataSource = dt;

            MessageBox.Show("Updated Succesfully!");
        }
Ejemplo n.º 6
0
        public DailyLoss(string userd, string staffd, string uleveld)
        {
            InitializeComponent();
            staffdim  = staffd;
            username  = userd;
            userlevel = uleveld;
            array_daily.Clear();
            dt.Clear();

            txtBinCode.Focus();
            //txtQuantity.Enabled = false;
            dt.Columns.Add(new DataColumn("Posting Date"));
            dt.Columns.Add(new DataColumn("Item No."));
            dt.Columns.Add(new DataColumn("Location"));
            dt.Columns.Add(new DataColumn("Quantity"));
            dt.Columns.Add(new DataColumn("Bin Code"));
            dt.Columns.Add(new DataColumn("Staff Dimsn"));
            dt.Columns.Add(new DataColumn("LineNo"));
            dt.Columns.Add(new DataColumn("EmptyTank"));

            // MnuNewGRN.Enabled = false;
            lblStaffName.Text = staffd + "/Role:" + uleveld;
            Main.Show();
            st = DateTime.Now.ToString("ddMMyyyy");


            CompactSQL comsql = new CompactSQL();

            getdata = comsql.SelectRecord("DailyLoss");
            GetSQLData(getdata);
        }
Ejemplo n.º 7
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);
            }
        }
Ejemplo n.º 8
0
        public DailyLossTS(string usname, string staffdimen, string uslevel, List <DailyLossFormTS> rebindArray, DailyLossFormTS currentControl)
        {
            try
            {
                InitializeComponent();
                staffname  = usname;
                stafflevel = uslevel;
                staffdim   = staffdimen;

                string[] tempstr = currentControl.itemno.Split('~');

                txtItemNo.Text            = tempstr[0].ToString();
                txtBinCode.Text           = currentControl.bincode;
                txtLocation.Text          = currentControl.location;
                cboEntryType.SelectedItem = currentControl.entrytype;
                txtPostingDate.Text       = currentControl.postdate.ToString();
                txtQuantity.Text          = currentControl.quantity;
                txtDescription.Text       = tempstr[1].ToString();

                lblStaffName.Text = staffdim + "/Role:" + uslevel;

                RebindToGrid(rebindArray);

                CompactSQL comsql = new CompactSQL();
                getdata = comsql.SelectRecord("ChangeSize");
                GetSQLData(getdata);
                ///
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 9
0
        private void ExportStockTakeTableToXML()
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                CompactSQL      comsql = new CompactSQL();
                SqlCeDataReader lgetdata;
                lgetdata = comsql.SelectRecord("StockTakeEntry");
                //if (lgetdata[0] != DBNull.Value)
                //{
                string ApplicationPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
                ApplicationPath = ApplicationPath + "\\Stocktake.xml";
                if (File.Exists(ApplicationPath))
                {
                    File.Delete(ApplicationPath);
                }
                DataSet   ds = new DataSet();
                DataTable dt = ds.Tables.Add();
                dt.Load(lgetdata);
                ds.WriteXml(ApplicationPath);
                MessageBox.Show("Backup Successfully");

                //StreamReader streamReader = File.OpenText(ApplicationPath);
                //string xmlString = streamReader.ReadToEnd().ToString();
                //streamReader.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            Cursor.Current = Cursors.Default;
        }
Ejemplo n.º 10
0
        private void AddtoRow(string ino, string bno, int qt, DateTime post, string sname, DateTime entry, string categ, string loc)
        {
            object[] array = new object[7];
            QHMobile.App_Data.STModule module = new QHMobile.App_Data.STModule();
            array[0] = module.ItemNo = ino;
            array[1] = module.binNo = bno;
            array[2] = module.qty = qt;
            array[3] = module.postDate = post;
            array[4] = module.staffName = sname;
            //array[5] = module.entryDate = entry;
            module.entryDate = entry;
            array[5]         = module.category = categ;
            array[6]         = module.loc = loc;

            dt.Rows.Add(array);
            lblCount.Text = dt.Rows.Count.ToString();
            stmod.Add(module);

            txtItemNo.Enabled = true;
            txtBin.Enabled    = true;

            CompactSQL comsql = new CompactSQL();

            comsql.InsertRecord("StockTakeEntry", array);
        }
Ejemplo n.º 11
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Object[] array = new Object[6];

            for (int j = 0; j < pomod.Count; j++)
            {
                if (txtScanItemNo.SelectedValue.ToString().Equals(pomod[j].lineno.ToString()))
                {
                    QHMobile.POModule assignPO = new POModule();

                    array[0]             = pomod[j].lineno;
                    assignPO.lineno      = pomod[j].lineno;
                    array[1]             = pomod[j].itemNo;
                    assignPO.itemNo      = pomod[j].itemNo;
                    array[2]             = pomod[j].description;
                    assignPO.description = pomod[j].description;
                    array[3]             = txtqty.Text.Trim();
                    assignPO.quantity    = Convert.ToDecimal(txtqty.Text.Trim());
                    array[4]             = txtlocation.Text.Trim();
                    assignPO.location    = txtlocation.Text.Trim();
                    array[5]             = txtbin.Text.Trim();
                    assignPO.bin         = txtbin.Text.Trim();

                    dt.Rows.Add(array);
                    assignPOList.Add(assignPO);

                    CompactSQL compa = new CompactSQL();
                    compa.InsertPOAssign("POAssign", array, PutNumber, TONumber);
                    lblTotalQty.Text = "Total Qty of this item is : " + pomod[j].quantity;
                }

                GrdTO.DataSource = dt;
            }
        }
Ejemplo n.º 12
0
        private void deleteCurrentRow()
        {
            bool isFound = false;

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ///thurein
                    if ((dt.Rows[i][0].ToString() == GrdDailyLoss[GrdDailyLoss.CurrentCell.RowNumber, 0].ToString()) && (dt.Rows[i][1].ToString() == GrdDailyLoss[GrdDailyLoss.CurrentCell.RowNumber, 1].ToString()) && (dt.Rows[i][2].ToString() == GrdDailyLoss[GrdDailyLoss.CurrentCell.RowNumber, 2].ToString()) && !isFound)
                    {
                        //subtract from summary table
                        //CalculateSummaryTable(dg_stock[dg_stock.CurrentCell.RowNumber, 0].ToString(), dg_stock[dg_stock.CurrentCell.RowNumber, 1].ToString(), "-" + dg_stock[dg_stock.CurrentCell.RowNumber, 2].ToString(), dg_stock[dg_stock.CurrentCell.RowNumber, 3].ToString());
                        // DeleteToSummaryTable(GrdAddline[GrdAddline.CurrentCell.RowNumber, 0].ToString(), GrdAddline[GrdAddline.CurrentCell.RowNumber, 1].ToString(), "-" + GrdAddline[GrdAddline.CurrentCell.RowNumber, 2].ToString(), GrdAddline[GrdAddline.CurrentCell.RowNumber, 3].ToString());
                        //addToSummaryTable(dg_stock[dg_stock.CurrentCell.RowNumber, 0].ToString(), dg_stock[dg_stock.CurrentCell.RowNumber, 1].ToString(), "-" + dg_stock[dg_stock.CurrentCell.RowNumber, 2].ToString());

                        CompactSQL comsql = new CompactSQL();
                        comsql.deleteRecordLine("ChangeSize", Convert.ToInt32(GrdDailyLoss[GrdDailyLoss.CurrentCell.RowNumber, 8].ToString().Trim()));

                        dt.Rows.RemoveAt(i);
                        dl_array.RemoveAt(i);
                        isFound = true;
                    }
                }
            }
        }
Ejemplo n.º 13
0
        public DailyLossTS(string usname, string staffdimen, string uslevel)
        {
            InitializeComponent();
            try
            {
                staffdim   = staffdimen;
                staffname  = usname;
                stafflevel = uslevel;

                dl_array.Clear();
                dt.Clear();
                dtpost.Clear();
                GrdDailyLoss.DataSource = null;

                lblStaffName.Text = staffdim + "/Role:" + uslevel;
                count             = 0;
                dt.Columns.Add("Item No");
                dt.Columns.Add("Description");
                dt.Columns.Add("EntryType");
                dt.Columns.Add("Location");
                dt.Columns.Add("Bin Code");
                dt.Columns.Add("Quantity");
                dt.Columns.Add("StaffDimension");
                dt.Columns.Add("PostingDate");
                dt.Columns.Add("LineNo");
                dt.Columns.Add("EmptyTank");


                dtpost.Columns.Add("Item No");
                dtpost.Columns.Add("Location");
                dtpost.Columns.Add("Bin Code");
                dtpost.Columns.Add("Entry Type");
                dtpost.Columns.Add("Quantity");
                BindToPost();

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


                if (uslevel.Equals("Super"))
                {
                    tbDL.Show();

                    menuItem1.Enabled = true;
                }
                else
                {
                    tbDL.Show();
                    menuItem1.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 14
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();
        }
Ejemplo n.º 15
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;
 }
Ejemplo n.º 16
0
        private void btnConfirmUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                PoArray[updatnumber].location = txtEditLocation.Text;
                PoArray[updatnumber].quantity = txtEditQuantity.Text;


                GrdPO.DataSource = null;
                dt.Clear();
                for (int i = 0; i < PoArray.Count; i++)
                {
                    Object[] array = new Object[4];

                    array[0] = PoArray[i].itemno;
                    array[1] = PoArray[i].itemDescription;
                    array[2] = PoArray[i].location;
                    array[3] = PoArray[i].quantity;

                    dt.Rows.Add(array);
                }
                Object[] arraySQLUpdate = new Object[2];
                arraySQLUpdate[0] = txtEditLocation.Text;
                arraySQLUpdate[1] = Convert.ToInt32(txtEditQuantity.Text.Trim());
                CompactSQL comsql = new CompactSQL();
                comsql.updatePOLine(arraySQLUpdate, Convert.ToInt32(txtLineno.Text));

                //CompactSQL comsql = new CompactSQL();
                getdata = comsql.SelectRecord("PurchaseOrder");
                GetSQLData(getdata, false);

                //GrdPO.DataSource = dt;
                Cursor.Current = Cursors.Default;
                MessageBox.Show("Updated Succesfully!");
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 17
0
        private void deleteCurrentRow()
        {
            bool isFound = false;

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if ((dt.Rows[i][0].ToString() == dgGRNLine[dgGRNLine.CurrentCell.RowNumber, 0].ToString()) && (dt.Rows[i][1].ToString() == dgGRNLine[dgGRNLine.CurrentCell.RowNumber, 1].ToString()) && (dt.Rows[i][2].ToString() == dgGRNLine[dgGRNLine.CurrentCell.RowNumber, 2].ToString()) && !isFound)
                    {
                        CompactSQL comsql = new CompactSQL();
                        comsql.deleteRecordLine("StockTakeEntry", Convert.ToInt32(dgGRNLine[dgGRNLine.CurrentCell.RowNumber, 6].ToString().Trim()));

                        dt.Rows.RemoveAt(i);
                        stmod.RemoveAt(i);
                        isFound = true;
                    }
                }
            }
        }
Ejemplo n.º 18
0
        private void deleteCurrentRow()
        {
            bool isFound = false;

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if ((dt.Rows[i][0].ToString() == GrdPO[GrdPO.CurrentCell.RowNumber, 0].ToString()) && (dt.Rows[i][1].ToString() == GrdPO[GrdPO.CurrentCell.RowNumber, 1].ToString()) && (dt.Rows[i][2].ToString() == GrdPO[GrdPO.CurrentCell.RowNumber, 2].ToString()) && !isFound)
                    {
                        //int tt = Convert.ToInt32(GrdPO[GrdPO.CurrentCell.RowNumber, 4].ToString().Trim());
                        CompactSQL comsql = new CompactSQL();
                        comsql.deleteRecordLine("PurchaseOrder", Convert.ToInt32(GrdPO[GrdPO.CurrentCell.RowNumber, 4].ToString().Trim()));
                        dt.Rows.RemoveAt(i);
                        PoArray.RemoveAt(i);
                        isFound = true;
                    }
                }
            }
        }
Ejemplo n.º 19
0
        public POAssignV1(string Rstaffname, string Rstaffdimen, string Rstafflevel, string ponumber)
        {
            InitializeComponent();
            CleanArray();

            RstName      = Rstaffname;
            Rstdimension = Rstaffdimen;
            RstLevel     = Rstafflevel;

            dtPo.Columns.Add(new DataColumn("Line No"));
            dtPo.Columns.Add(new DataColumn("Item No."));
            dtPo.Columns.Add(new DataColumn("Description"));
            dtPo.Columns.Add(new DataColumn("Quantity"));
            dtPo.Columns.Add(new DataColumn("Location"));

            dt.Columns.Add(new DataColumn("Line No"));
            dt.Columns.Add(new DataColumn("Item No."));
            dt.Columns.Add(new DataColumn("Description"));
            dt.Columns.Add(new DataColumn("Quantity"));
            dt.Columns.Add(new DataColumn("Location"));
            dt.Columns.Add(new DataColumn("Bin"));

            string[] po = AssignPO(ponumber);
            TONumber = txtTO.Text = po[0];

            CompactSQL comsql = new CompactSQL();

            getallrecords = comsql.SelectRecordPOAssign("POAssign", TONumber);

            if (getallrecords.Read())
            {
                MessageBox.Show("Here has got SQL value!");
                GetRecordsFromSQL(getallrecords);
            }
            else
            {
                CheckPO();
            }
        }
Ejemplo n.º 20
0
        private void InsertLines()
        {
            ItemJournalL insertOneLine = new ItemJournalL();

            Object[] array = new Object[8];

            insertOneLine.postingDate = DateTime.Now;
            array[0]                     = DateTime.Now;
            insertOneLine.ItemNo         = txtItemNo.Text.Trim();
            array[1]                     = txtItemNo.Text.Trim();
            insertOneLine.location       = "QH1";
            array[2]                     = "QH1";
            insertOneLine.frombin        = txtFromBin.Text.Trim();
            array[3]                     = txtFromBin.Text.Trim();
            insertOneLine.tobin          = txtToBin.Text.Trim();
            array[4]                     = txtToBin.Text.Trim();
            insertOneLine.quantity       = Convert.ToInt32(textBox1.Text.Trim());
            array[5]                     = textBox1.Text.Trim();
            insertOneLine.staffdimension = staffdimension;
            array[6]                     = staffdimension;
            if (chkEmpty.Checked)
            {
                insertOneLine.emptyBin = true;
                array[7] = true;
            }
            else
            {
                insertOneLine.emptyBin = false;
                array[7] = false;
            }

            tableJournal.Rows.Add(array);
            journalarray.Add(insertOneLine);

            CompactSQL comsql = new CompactSQL();

            comsql.InsertRecord("ItemReclass", array);
        }
Ejemplo n.º 21
0
        public PurChaseOrder(string usng, string staffdimg, string uslvelg)
        {
            InitializeComponent();
            PoArray.Clear();
            dt.Clear();

            txtRegDate.Text = DateTime.Now.ToString("dd/MM/yyyy");
            vuser           = usng;
            vstaffdimension = staffdimg;
            vstafflevel     = uslvelg;


            dt.Columns.Add("Item No");
            dt.Columns.Add("Item Description");
            dt.Columns.Add("Location");
            dt.Columns.Add("Quantity");
            dt.Columns.Add("LineNo");

            CompactSQL comsql = new CompactSQL();

            getdata = comsql.SelectRecord("PurchaseOrder");
            GetSQLData(getdata, true);
        }
Ejemplo n.º 22
0
        private void menuItem1_Click(object sender, EventArgs e)
        {
            if (GrdDailyLoss == null)
            {
                MessageBox.Show("There is no record to register!");
            }
            else
            {
                Cursor.Current = Cursors.WaitCursor;

                try
                {
                    decimal countotal = 0;
                    bool    flagtemp  = false;
                    string  itemtemp;
                    string  locationtemp;
                    string  bincodetemp;

                    ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service dlservice = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service();
                    dlservice.Url         = WebServiceInstants.GetURL(ServiceType.ItemJournalDailyLossQH);
                    dlservice.Credentials = nc;

                    QHSalesReceivableSetup.QHSalesReceivableSetup_Service qhsalesev = new QHMobile.QHSalesReceivableSetup.QHSalesReceivableSetup_Service();
                    qhsalesev.Credentials = nc;
                    qhsalesev.Url         = WebServiceInstants.GetURL(ServiceType.QHSalesReceivableSetup);

                    QHSalesReceivableSetup.QHSalesReceivableSetup[] qhsaleGet = qhsalesev.ReadMultiple(null, null, 0);


                    for (int i = 0; i < dl_array.Count; i++)
                    {
                        ItemJournalDailyLossQH.ItemJournalDailyLossQH dl = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH();

                        dlservice.Create(qhsaleGet[0].Change_Size_Batch, ref dl); // Actual value should be DOA

                        dl.Posting_Date = DateTime.Now;

                        if (dl_array[i].entrytype.Equals("Positive Adjmt."))
                        {
                            dl.Entry_Type = ItemJournalDailyLossQH.Entry_Type.Positive_Adjmt;
                        }
                        else if (dl_array[i].entrytype.Equals("Negative Adjmt."))
                        {
                            dl.Entry_Type = ItemJournalDailyLossQH.Entry_Type.Negative_Adjmt;
                        }

                        dl.Entry_TypeSpecified = true;

                        dl.Item_No       = dl_array[i].itemno;
                        dl.Quantity      = Convert.ToInt32(dl_array[i].quantity);
                        dl.Location_Code = dl_array[i].location;
                        //dl.Posting_Date = dl_array[i].postdate;
                        dl.Staff_Dimension_Code = staffdim;
                        dl.Bin_Code             = dl_array[i].bincode;

                        dlservice.Update(qhsaleGet[0].Change_Size_Batch, ref dl);
                    }
                    //// to adjust ////

                    ArrayList tnk = new ArrayList();
                    for (int i = 0; i < dl_array.Count; i++)
                    {
                        if ((dl_array[i].EmptyTank == true) && (dl_array[i].entrytype.Equals("Negative Adjmt.")))
                        {
                            if (i == 0)
                            {
                                tnk.Add(dl_array[i].bincode);
                            }
                            else
                            {
                                if (!tnk.Contains(dl_array[i].bincode))
                                {
                                    tnk.Add(dl_array[i].bincode);
                                }
                            }
                        }
                    }

                    for (int j = 0; j < tnk.Count; j++)
                    {
                        countotal    = 0;
                        flagtemp     = false;
                        itemtemp     = "";
                        locationtemp = "";
                        bincodetemp  = "";

                        for (int k = 0; k < dl_array.Count; k++)
                        {
                            if ((dl_array[k].EmptyTank == true) && (dl_array[k].entrytype.Equals("Negative Adjmt.")))
                            {
                                if (tnk[j].ToString().Equals(dl_array[k].bincode))
                                {
                                    itemtemp     = dl_array[k].itemno;
                                    countotal    = countotal + Convert.ToDecimal(dl_array[k].quantity);
                                    locationtemp = dl_array[k].location;
                                    bincodetemp  = dl_array[k].bincode;

                                    if (dl_array[k].EmptyTank == true)
                                    {
                                        flagtemp = true;
                                    }
                                }
                            }
                        }

                        //QHBinContent.QHBinContent_Service qhsev = new QHMobile.QHBinContent.QHBinContent_Service();
                        //qhsev.Credentials = nc;
                        //qhsev.Url = WebServiceInstants.GetURL(ServiceType.QHBinContent);

                        //List<QHBinContent.QHBinContent_Filter> filterArr = new List<QHMobile.QHBinContent.QHBinContent_Filter>();

                        //QHBinContent.QHBinContent_Filter binfilter = new QHMobile.QHBinContent.QHBinContent_Filter();
                        //binfilter.Field = QHMobile.QHBinContent.QHBinContent_Fields.Bin_Code;
                        //binfilter.Criteria = bincodetemp;

                        ////QHBinContent.QHBinContent_Filter Qtyfilter = new QHMobile.QHBinContent.QHBinContent_Filter();
                        ////Qtyfilter.Field = QHMobile.QHBinContent.QHBinContent_Fields.Quantity_Base;
                        ////Qtyfilter.Criteria = "<>0";

                        //QHBinContent.QHBinContent_Filter itemFilter = new QHMobile.QHBinContent.QHBinContent_Filter();
                        //itemFilter.Field = QHMobile.QHBinContent.QHBinContent_Fields.Item_No;
                        //itemFilter.Criteria = itemtemp;

                        //filterArr.Add(binfilter);
                        ////filterArr.Add(Qtyfilter);
                        //filterArr.Add(itemFilter);

                        //QHBinContent.QHBinContent[] qhbincon = qhsev.ReadMultiple(filterArr.ToArray(), null, 5);

                        if (flagtemp == true) //qhbincon[0].Quantity_Base < countotal ||
                        {
                            //  qhfun.TankAdj_NAV(itemtemp, packworksheet, locationtemp, bincodetemp, countotal, flagtemp);
                            //qhfun.TankAdj_NAV(itemtemp, packworksheet, locationtemp, bincodetemp, countotal);

                            QHEmptyTank.QHEmptyTank_Service qhempty = new QHMobile.QHEmptyTank.QHEmptyTank_Service();
                            qhempty.Url         = WebServiceInstants.GetURL(ServiceType.QHEmptyTank);
                            qhempty.Credentials = nc;

                            QHEmptyTank.QHEmptyTank qhcheck = qhempty.Read(bincodetemp);
                            if (qhcheck == null)
                            {
                                QHEmptyTank.QHEmptyTank qhtnk = new QHMobile.QHEmptyTank.QHEmptyTank();
                                qhtnk.Bin_Code = bincodetemp;
                                qhempty.Create(ref qhtnk);


                                qhtnk.Batch_Name    = qhsaleGet[0].Change_Size_Batch;
                                qhtnk.Item_No       = itemtemp;
                                qhtnk.Location_Code = locationtemp;
                                qhempty.Update(ref qhtnk);
                            }
                        }
                        //else if (qhbincon[0].Quantity - qhbincon[0].PDA_Inv_Pick_Quantity < countotal)
                        //{
                        //    QH_Functions.QH_Functions qhfun = new QHMobile.QH_Functions.QH_Functions();
                        //    qhfun.Url = WebServiceInstants.GetURL(ServiceType.QH_Functions);
                        //    qhfun.Credentials = nc;
                        //    decimal updatecount = countotal - (qhbincon[0].Quantity - qhbincon[0].PDA_Inv_Pick_Quantity);
                        //    qhfun.InsertIJLPositiveAdjustment(itemtemp, "", locationtemp, bincodetemp, updatecount);
                        //    //qhfun.TankAdj_NAV(itemtemp, "", locationtemp, bincodetemp, countotal, flagtemp);
                        //}
                    }

                    //// to adjust ////
                    CompactSQL comsql = new CompactSQL();
                    comsql.deleteRecord("ChangeSize");

                    MessageBox.Show("Submitted.");


                    this.Close();
                    DailyLossTS dilts = new DailyLossTS(staffname, staffdim, stafflevel);
                    dilts.Show();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error:" + ex);
                }
                Cursor.Current = Cursors.Default;

                //DailyLossTS dts = new DailyLossTS(staffname, staffdim, stafflevel);
            }
        }
Ejemplo n.º 23
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);
            }
        }
Ejemplo n.º 24
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                if (cboEntryType.SelectedText.Equals("Positive Adjmt.") && chkEmpty.Checked == true)
                {
                    MessageBox.Show("PDA: You cannot now allow to empty the bin in positive state.");
                }
                else
                {
                    if (count == 0)
                    {
                        if (!string.IsNullOrEmpty(txtItemNo.Text.Trim()) && !string.IsNullOrEmpty(txtBinCode.Text.Trim()) && !string.IsNullOrEmpty(txtLocation.Text.Trim()) && !string.IsNullOrEmpty(txtQuantity.Text.Trim()) && !txtQuantity.Text.Trim().Equals("0"))
                        //if (!txtItemNo.Text.Equals("") && !txtBinCode.Text.Equals("") && !txtLocation.Text.Equals("") && !txtQuantity.Text.Equals(""))
                        {
                            bool isNum = IsItNumber(txtQuantity.Text.Trim());

                            if (isNum)
                            {
                                bool flagLocation = LocationValidating();

                                bool flagItem = ItemValidating();

                                if (flagLocation == true && flagItem == true)
                                {
                                    DailyLossFormTS insert = new DailyLossFormTS();
                                    Object[]        array  = new Object[9];

                                    insert.itemno         = txtItemNo.Text.Trim();
                                    array[0]              = txtItemNo.Text.Trim();
                                    insert.entrytype      = cboEntryType.Text.Trim();
                                    array[1]              = txtDescription.Text.Trim();
                                    insert.description    = txtDescription.Text.Trim();
                                    array[2]              = cboEntryType.Text.Trim();
                                    insert.location       = txtLocation.Text.Trim();
                                    array[3]              = txtLocation.Text.Trim();
                                    insert.bincode        = txtBinCode.Text.Trim();
                                    array[4]              = txtBinCode.Text.Trim();
                                    insert.quantity       = txtQuantity.Text.Trim();
                                    array[5]              = txtQuantity.Text.Trim();
                                    insert.staffdimension = staffdim;
                                    array[6]              = staffdim;
                                    insert.postdate       = txtPostingDate.Text.Trim();
                                    array[7]              = Convert.ToDateTime(txtPostingDate.Text.Trim());
                                    if (chkEmpty.Checked)
                                    {
                                        array[8] = true;
                                    }
                                    else
                                    {
                                        array[8] = false;
                                    }
                                    dl_array.Add(insert);
                                    dt.Rows.Add(array);
                                    lblCount.Text = dt.Rows.Count.ToString();

                                    //tempthu
                                    CompactSQL comsql = new CompactSQL();
                                    comsql.InsertRecord("ChangeSize", array);

                                    getdata = comsql.SelectRecord("ChangeSize"); //test3
                                    GetSQLData(getdata);                         //test3
                                    CallBindGrid();
                                    //tempthu
                                    //CompactSQL comsql = new CompactSQL();
                                    //comsql.InsertRecord("ChangeSize", array);
                                }
                                else
                                {
                                    if (flagLocation == false)
                                    {
                                        BinQH.BinQH_Service binservice = new QHMobile.BinQH.BinQH_Service();
                                        binservice.Url         = WebServiceInstants.GetURL(ServiceType.BinQH);
                                        binservice.Credentials = nc;

                                        List <BinQH.BinQH_Filter> filterArr = new List <QHMobile.BinQH.BinQH_Filter>();

                                        BinQH.BinQH_Filter bincodefilter = new QHMobile.BinQH.BinQH_Filter();
                                        bincodefilter.Field    = QHMobile.BinQH.BinQH_Fields.Code;
                                        bincodefilter.Criteria = txtBinCode.Text.Trim();

                                        filterArr.Add(bincodefilter);


                                        BinQH.BinQH[] binqhget = binservice.ReadMultiple(filterArr.ToArray(), null, 3);

                                        if (binqhget.Length == 0)
                                        {
                                            MessageBox.Show("Location and Bin is not found.");
                                            txtItemNo.SelectAll();
                                            txtItemNo.Focus();
                                        }
                                        else
                                        {
                                            DailyLossFormTS insert = new DailyLossFormTS();
                                            Object[]        array  = new Object[9];

                                            insert.itemno         = txtItemNo.Text.Trim();
                                            array[0]              = txtItemNo.Text.Trim();
                                            insert.entrytype      = cboEntryType.Text.Trim();
                                            array[1]              = txtDescription.Text.Trim();
                                            insert.description    = txtDescription.Text.Trim();
                                            array[2]              = cboEntryType.Text.Trim();
                                            insert.location       = txtLocation.Text.Trim();
                                            array[3]              = txtLocation.Text.Trim();
                                            insert.bincode        = txtBinCode.Text.Trim();
                                            array[4]              = txtBinCode.Text.Trim();
                                            insert.quantity       = txtQuantity.Text.Trim();
                                            array[5]              = txtQuantity.Text.Trim();
                                            insert.staffdimension = staffdim;
                                            array[6]              = staffdim;
                                            insert.postdate       = txtPostingDate.Text.Trim();
                                            array[7]              = Convert.ToDateTime(txtPostingDate.Text.Trim());
                                            if (chkEmpty.Checked)
                                            {
                                                array[8] = true;
                                            }
                                            else
                                            {
                                                array[8] = false;
                                            }
                                            dl_array.Add(insert);
                                            dt.Rows.Add(array);
                                            lblCount.Text = dt.Rows.Count.ToString();

                                            //tempthu
                                            CompactSQL comsql = new CompactSQL();
                                            comsql.InsertRecord("ChangeSize", array);

                                            getdata = comsql.SelectRecord("ChangeSize"); //test3
                                            GetSQLData(getdata);                         //test3
                                            CallBindGrid();
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("All fields are required to enter.");
                        }

                        count = count + 1;
                        txtItemNo.SelectAll();
                        txtItemNo.Focus();
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(txtItemNo.Text.Trim()) && !string.IsNullOrEmpty(txtBinCode.Text.Trim()) && !string.IsNullOrEmpty(txtLocation.Text.Trim()) && !string.IsNullOrEmpty(txtQuantity.Text.Trim()) && !txtQuantity.Text.Trim().Equals("0"))
                        {
                            bool isNum = IsItNumber(txtQuantity.Text.Trim());

                            if (isNum)
                            {
                                // bool flagLocation = LocationValidating();

                                bool flagItem = ItemValidating();

                                if (flagItem == true)
                                {
                                    count = 0;

                                    DailyLossFormTS insert = new DailyLossFormTS();
                                    Object[]        array  = new Object[9];

                                    insert.itemno         = txtItemNo.Text.Trim();
                                    array[0]              = txtItemNo.Text.Trim();
                                    insert.entrytype      = cboEntryType.Text.Trim();
                                    array[1]              = txtDescription.Text.Trim();
                                    insert.description    = txtDescription.Text.Trim();
                                    array[2]              = cboEntryType.Text.Trim();
                                    insert.location       = txtLocation.Text.Trim();
                                    array[3]              = txtLocation.Text.Trim();
                                    insert.bincode        = txtBinCode.Text.Trim();
                                    array[4]              = txtBinCode.Text.Trim();
                                    insert.quantity       = txtQuantity.Text.Trim();
                                    array[5]              = txtQuantity.Text.Trim();
                                    insert.staffdimension = staffdim;
                                    array[6]              = staffdim;
                                    insert.postdate       = txtPostingDate.Text.Trim();
                                    array[7]              = Convert.ToDateTime(txtPostingDate.Text.Trim());
                                    if (chkEmpty.Checked)
                                    {
                                        array[8] = true;
                                    }
                                    else
                                    {
                                        array[8] = false;
                                    }

                                    dl_array.Add(insert);
                                    dt.Rows.Add(array);
                                    lblCount.Text = dt.Rows.Count.ToString();
                                    CallBindGrid();

                                    //CompactSQL comsql = new CompactSQL();
                                    //comsql.InsertRecord("ChangeSize", array);

                                    //tempthu
                                    CompactSQL comsql = new CompactSQL();
                                    comsql.InsertRecord("ChangeSize", array);

                                    getdata = comsql.SelectRecord("ChangeSize"); //test3
                                    GetSQLData(getdata);                         //test3
                                    CallBindGrid();
                                    //tempthu
                                }
                                else
                                {
                                    if (flagItem == false)
                                    {
                                        MessageBox.Show("Item is not found.");
                                        txtItemNo.Focus();
                                    }
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("All fields are required to enter.");
                        }
                    }

                    if (count == 1)
                    {
                        // txtBinCode.Enabled = false;
                        //txtItemNo.Enabled = true;
                        txtLocation.Enabled = false;
                        cboEntryType.Text   = cboEntryType.Items[0].ToString();
                    }
                    else
                    {
                        txtBinCode.Enabled  = true;
                        txtBinCode.Text     = "";
                        txtItemNo.Enabled   = true;
                        txtItemNo.Text      = "";
                        txtLocation.Enabled = true;
                        txtLocation.Text    = "";
                        txtQuantity.Text    = "";
                        txtBinCode.Focus();
                        cboEntryType.Text = cboEntryType.Items[1].ToString();
                    }
                    Cursor.Current = Cursors.Default;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Cursor.Current = Cursors.Default;
            }
        }
Ejemplo n.º 25
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                if (!string.IsNullOrEmpty(txtBinCode.Text.Trim()) && !string.IsNullOrEmpty(txtQuantity.Text.Trim()) && !txtQuantity.Text.Trim().Equals("0") && !string.IsNullOrEmpty(txtItemNo.Text.Trim()) && !string.IsNullOrEmpty(txtQuantity.Text.Trim()) && !string.IsNullOrEmpty(txtLocation.Text.Trim()) && !string.IsNullOrEmpty(txtPostingDate.Text.Trim()))
                //if (!txtBinCode.Text.Equals("") && !txtQuantity.Text.Equals("") && !txtItemNo.Text.Equals("") && !txtQuantity.Text.Equals("") && !txtLocation.Text.Equals("") && !txtPostingDate.Text.Equals(""))
                {
                    bool isNum = IsItNumber(txtQuantity.Text.Trim());

                    if (isNum)
                    {
                        int flagLocation = QtyValidating();

                        //bool flagItem = ItemValidating();

                        if (flagLocation == 1 || flagLocation == 2)
                        {
                            DailyLossQH insert_dl = new DailyLossQH();
                            Object[]    array     = new Object[7];

                            insert_dl.itemno = txtItemNo.Text.Trim();
                            array[0]         = Convert.ToDateTime(txtPostingDate.Text);

                            insert_dl.location       = txtLocation.Text.Trim();
                            array[1]                 = txtItemNo.Text.Trim();
                            insert_dl.quantity       = txtQuantity.Text.Trim();
                            array[2]                 = txtLocation.Text.Trim();
                            insert_dl.bincode        = txtBinCode.Text.Trim();
                            array[3]                 = txtQuantity.Text.Trim();
                            insert_dl.postingDate    = txtPostingDate.Text;
                            array[4]                 = txtBinCode.Text.Trim();
                            insert_dl.staffdimension = staffdim;
                            array[5]                 = staffdim;
                            if (chkEmpty.Checked)
                            {
                                insert_dl.emptyTank = true;
                                array[6]            = true;
                            }
                            else
                            {
                                insert_dl.emptyTank = false;
                                array[6]            = false;
                            }



                            array_daily.Add(insert_dl);
                            dt.Rows.Add(array);
                            lblCount.Text = dt.Rows.Count.ToString();
                            //CallGridBind();

                            CompactSQL comsql = new CompactSQL();
                            comsql.InsertRecord("DailyLoss", array);

                            getdata = comsql.SelectRecord("DailyLoss");
                            GetSQLData(getdata);


                            txtQuantity.Text    = "";
                            txtItemNo.Text      = "";
                            txtLocation.Text    = "";
                            txtPostingDate.Text = "";
                            txtBinCode.Enabled  = true;
                            txtBinCode.Text     = "";
                            txtBinCode.Focus();
                            chkEmpty.Checked = false;
                        }
                        else if (flagLocation == 3)
                        {
                            MessageBox.Show("Item Not found!");
                        }
                        else
                        {
                            //MessageBox.Show("Item Not found!");
                            txtQuantity.Focus();
                            //if (flagLocation == 2)
                            //{
                            //    MessageBox.Show("Item Not found!");
                            //    txtQuantity.Focus();
                            //}
                            //else
                            //{
                            //    MessageBox.Show("Item is not found.");
                            //    txtItemNo.Focus();
                            //}
                        }
                    }
                    else
                    {
                        MessageBox.Show("Quantity value must be integer.");
                        txtQuantity.Text = "";
                        txtQuantity.Focus();
                    }

                    txtQuantity.Enabled    = false;
                    txtPostingDate.Enabled = false;
                    //txtBinCode.Enabled = true;
                }
                else
                {
                    MessageBox.Show("All fields are required to enter and quantity must be larger than 0.");
                    txtBinCode.SelectAll();
                    txtBinCode.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }

            Cursor.Current = Cursors.Default;
        }
Ejemplo n.º 26
0
        private void menuItem1_Click(object sender, EventArgs e)
        {
            if (GrdDailyLoss.DataSource == null)
            {
                MessageBox.Show("There is no record to register!");
            }
            else
            {
                Cursor.Current = Cursors.WaitCursor;

                try
                {
                    decimal countotal = 0;
                    bool    flagtemp  = false;
                    string  itemtemp;
                    string  locationtemp;
                    string  bincodetemp;


                    ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service dlservice = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service();
                    dlservice.Url         = WebServiceInstants.GetURL(ServiceType.ItemJournalDailyLossQH);
                    dlservice.Credentials = nc;

                    for (int i = 0; i < array_daily.Count; i++)
                    {
                        if (array_daily[i].lineNum.Equals("") || array_daily[i].lineNum == 0)
                        {
                            ItemJournalDailyLossQH.ItemJournalDailyLossQH dl = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH();

                            dlservice.Create("DOA", ref dl);     // Actual value should be DOA

                            ItemJournalDailyLossQH.ItemJournalDailyLossQH dlupdate = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH();
                            dlupdate = dlservice.Read("DOA", dl.Line_No);

                            //added by Hsu 23 april 2013//
                            array_daily[i].lineNum = dl.Line_No;

                            // added by Hsu 23 april 2013 //
                            dlupdate.Posting_Date          = Convert.ToDateTime(array_daily[i].postingDate);
                            dlupdate.Posting_DateSpecified = true;
                            dlupdate.Entry_Type            = ItemJournalDailyLossQH.Entry_Type.Negative_Adjmt;
                            dlupdate.Entry_TypeSpecified   = true;
                            dlupdate.Item_No = array_daily[i].itemno;

                            st = DateTime.Now.ToString("ddMMyyyy");
                            dlupdate.Document_No = st;

                            //dlservice.Update("DOA", ref dlupdate);

                            dlupdate.Quantity             = Convert.ToInt32(array_daily[i].quantity);
                            dlupdate.Location_Code        = array_daily[i].location;
                            dlupdate.Staff_Dimension_Code = staffdim;
                            dlupdate.Bin_Code             = array_daily[i].bincode;

                            dlservice.Update("DOA", ref dlupdate);
                            //array_daily.RemoveAt(i);
                        }

                        CompactSQL comsql = new CompactSQL();
                        comsql.DeleteOneRecord(array_daily[i].sqlLineNum, "DailyLoss");
                    }
                    //// to adjust ////

                    ArrayList tnk = new ArrayList();
                    for (int i = 0; i < array_daily.Count; i++)
                    {
                        if (i == 0)
                        {
                            tnk.Add(array_daily[i].bincode);
                        }
                        else
                        {
                            if (!tnk.Contains(array_daily[i].bincode))
                            {
                                tnk.Add(array_daily[i].bincode);
                            }
                        }
                    }

                    for (int j = 0; j < tnk.Count; j++)
                    {
                        countotal    = 0;
                        flagtemp     = false;
                        itemtemp     = "";
                        locationtemp = "";
                        bincodetemp  = "";

                        for (int k = 0; k < array_daily.Count; k++)
                        {
                            if (tnk[j].ToString().Equals(array_daily[k].bincode))
                            {
                                itemtemp     = array_daily[k].itemno;
                                countotal    = countotal + Convert.ToDecimal(array_daily[k].quantity);
                                locationtemp = array_daily[k].location;
                                bincodetemp  = array_daily[k].bincode;

                                if (array_daily[k].emptyTank == true)
                                {
                                    flagtemp = true;
                                }
                            }
                        }

                        if (flagtemp == true)     //qhbincon[0].Quantity_Base < countotal ||
                        {
                            QHEmptyTank.QHEmptyTank_Service qhempty = new QHMobile.QHEmptyTank.QHEmptyTank_Service();
                            qhempty.Url         = WebServiceInstants.GetURL(ServiceType.QHEmptyTank);
                            qhempty.Credentials = nc;

                            QHEmptyTank.QHEmptyTank qhcheck = qhempty.Read(bincodetemp);
                            if (qhcheck == null)
                            {
                                QHEmptyTank.QHEmptyTank qhtnk = new QHMobile.QHEmptyTank.QHEmptyTank();
                                qhtnk.Bin_Code = bincodetemp;

                                qhempty.Create(ref qhtnk);


                                qhtnk.Batch_Name    = "DOA";
                                qhtnk.Item_No       = itemtemp;
                                qhtnk.Location_Code = locationtemp;
                                qhempty.Update(ref qhtnk);
                            }
                        }
                    }

                    //// to adjsut ////

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

                    MessageBox.Show("Submitted.");
                    Cursor.Current          = Cursors.Default;
                    GrdDailyLoss.DataSource = null;
                    this.Close();
                    DailyLoss dlf = new DailyLoss(username, staffdim, userlevel);
                    dlf.Show();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error:" + ex);
                    Cursor.Current = Cursors.Default;
                }
            }
        }
Ejemplo n.º 27
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);
            }
        }
Ejemplo n.º 28
0
        private void mnuRegisterToNav_Click(object sender, EventArgs e)
        {
            try
            {
                if (GrdPO.DataSource != null)
                {
                    Cursor.Current = Cursors.WaitCursor;

                    PurchaseQH.PurchaseQH_Service purSev = new QHMobile.PurchaseQH.PurchaseQH_Service();
                    purSev.Credentials = nc;
                    purSev.Url         = WebServiceInstants.GetURL(ServiceType.PurchaseQH);


                    PurchaseQH.PurchaseQH phcreate = new QHMobile.PurchaseQH.PurchaseQH();

                    purSev.Create(ref phcreate);

                    PO = phcreate.No;


                    PurchaseQH.PurchaseQH phupdate = purSev.Read(phcreate.No);

                    phupdate.Buy_from_Vendor_No = txtVendorNo.Text.Trim();

                    phupdate.Buy_from_Vendor_Name = txtVendorName.Text.Trim();

                    phupdate.Order_Date = DateTime.Now;

                    purSev.Update(ref phupdate);

                    phupdate.PurchLines = new QHMobile.PurchaseQH.Purchase_Order_Line[PoArray.Count];

                    for (int i = 0; i < PoArray.Count; i++)
                    {
                        phupdate.PurchLines[i] = new QHMobile.PurchaseQH.Purchase_Order_Line();
                    }

                    purSev.Update(ref phupdate);

                    for (int j = 0; j < phupdate.PurchLines.Length; j++)
                    {
                        phupdate.PurchLines[j].Type          = QHMobile.PurchaseQH.Type.Item;
                        phupdate.PurchLines[j].No            = PoArray[j].itemno;
                        phupdate.PurchLines[j].Location_Code = PoArray[j].location;
                        phupdate.PurchLines[j].Quantity      = Convert.ToInt32(PoArray[j].quantity);
                        phupdate.PurchLines[j].Bin_Code      = "";
                    }

                    purSev.Update(ref phupdate);

                    lblPO.Text = "PO:" + phupdate.No;

                    if (!String.IsNullOrEmpty(phupdate.No))
                    {
                        QH_Functions.QH_Functions qhfun = new QHMobile.QH_Functions.QH_Functions();
                        qhfun.Credentials = nc;
                        qhfun.Url         = WebServiceInstants.GetURL(ServiceType.QH_Functions);
                        //qhfun.ReleasePO(PO);
                        qhfun.ReleasePO(phupdate.No.Trim());
                        MessageBox.Show("Purchase Order is created succesfully!" + phupdate.No);


                        CompactSQL comsql = new CompactSQL();
                        comsql.deleteRecord("PurchaseOrder");
                        PurChaseOrder po = new PurChaseOrder(vuser, vstaffdimension, vstafflevel);
                        po.Show();
                    }

                    Cursor.Current = Cursors.Default;
                }
                else
                {
                    MessageBox.Show("There is no line to post!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:" + ex);
            }
        }
Ejemplo n.º 29
0
        private void btnAdd_Click_1(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                Object[]            array    = new Object[4];
                PurchaseOrderModule pomodule = new PurchaseOrderModule();

                array[0] = txtItemNo.Text.Trim();
                //SQL to save
                Object[] arraySQL = new Object[7];
                pomodule.itemno = txtItemNo.Text.Trim();
                arraySQL[0]     = txtVendorNo.Text.Trim();
                arraySQL[1]     = txtVendorName.Text.Trim();
                arraySQL[2]     = txtRegDate.Text.Trim();
                arraySQL[3]     = txtLocation.Text.Trim();
                arraySQL[4]     = txtItemNo.Text.Trim();
                arraySQL[6]     = Convert.ToInt32(txtQty.Text.Trim());


                if (!String.IsNullOrEmpty(txtItemNo.Text.Trim()))
                {
                    ItemQH.ItemQH_Service itemsev = new QHMobile.ItemQH.ItemQH_Service();
                    itemsev.Url         = WebServiceInstants.GetURL(ServiceType.ItemQH);
                    itemsev.Credentials = nc;

                    ItemQH.ItemQH itemdescription = itemsev.Read(txtItemNo.Text.Trim());
                    string        strItemDescription;
                    strItemDescription       = itemdescription.Description;
                    pomodule.itemDescription = strItemDescription;
                    array[1]    = strItemDescription;
                    arraySQL[5] = strItemDescription;
                }
                else
                {
                    arraySQL[5] = "";
                    pomodule.itemDescription = "";
                    array[1] = "";
                }


                array[2]          = txtLocation.Text.Trim();
                pomodule.location = txtLocation.Text.Trim();
                array[3]          = txtQty.Text.Trim();
                pomodule.quantity = txtQty.Text.Trim();


                PoArray.Add(pomodule);
                dt.Rows.Add(array);

                CompactSQL comsql = new CompactSQL();
                comsql.InsertRecord("PurchaseOrder", arraySQL);

                /*
                 *  GrdPO.DataSource = dt;
                 *
                 *
                 *  txtItemNo.Text = "";
                 *  txtItemNo.Focus();
                 *  txtLocation.Enabled = false;
                 *  txtRegDate.Enabled = false;
                 *  txtQty.Enabled = false;
                 */

                //dffd

                getdata = comsql.SelectRecord("PurchaseOrder");
                GetSQLData(getdata, false);

                Cursor.Current = Cursors.Default;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:" + ex);
                Cursor.Current = Cursors.Default;
            }
        }
Ejemplo n.º 30
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(txtBin.Text) && !string.IsNullOrEmpty(txtItemNo.Text) && !string.IsNullOrEmpty(txtQty.Text))
                {
                    txtBin.Enabled    = true;
                    txtQty.Enabled    = false;
                    txtItemNo.Enabled = false;
                    textBox1.Enabled  = false;

                    string   itemNo;
                    string   binNo;
                    int      quantity;
                    DateTime postdate;
                    string   staffname;
                    DateTime entrydate;
                    string   categ;

                    itemNo    = txtItemNo.Text;
                    binNo     = txtBin.Text;
                    postdate  = Convert.ToDateTime(textBox1.Text);
                    staffname = staffdim;
                    entrydate = Convert.ToDateTime(textBox1.Text);
                    categ     = txtCategory.Text.Trim();

                    bool isNum = IsItNumber(txtQty.Text.Trim());

                    if (txtQty.Text.Equals("") || txtBin.Text.Equals(""))
                    {
                        MessageBox.Show("All field are required to enter");
                    }
                    else
                    {
                        if (isNum)
                        {
                            quantity = Convert.ToInt32(txtQty.Text);
                            AddtoRow(itemNo, binNo, quantity, postdate, staffname, entrydate, categ);
                            //dgGRNLine.DataSource = dt;
                            CompactSQL comsql = new CompactSQL();
                            getdata = comsql.SelectRecord("StockTakeEntry");
                            GetSQLData(getdata);



                            txtBin.Focus();
                            txtItemNo.Text       = "";
                            textBox1.Text        = "";
                            txtQty.Text          = "";
                            txtBin.Text          = "";
                            txtCategory.Text     = "";
                            txtDescription.Text  = "";
                            txtDescription2.Text = "";
                        }
                        else
                        {
                            MessageBox.Show("Invalid Qty Number!");
                            txtQty.Text = "";
                            txtQty.Focus();
                            dgGRNLine.DataSource = dt;
                        }
                    }
                }
            }catch (Exception ex)
            {
                MessageBox.Show("Error" + ex);
            }
        }