Ejemplo n.º 1
0
        public void AddStockIssueLine(StockIssueLine siNewLine)
        {
            Array.Resize<Control>(ref aStockIssueLines, aStockIssueLines.Length + 1);

            aStockIssueLines[aStockIssueLines.Length - 1] = siNewLine;

            //JR13
            if (iLineRowIndex < 14)
                siNewLine.Top = 22 + ((iLineRowIndex) * 20);
            else
                siNewLine.Top = 268; //16 + ((iLineRowIndex) * 18);

            siNewLine.Left = 1;

            siNewLine.TabIndex = 50 + aStockIssueLines.Length;
            siNewLine.TabStop = true;

            siNewLine.iLineIndex = aStockIssueLines.Length - 1;
            siNewLine.Name = "siNewLine_" + (aStockIssueLines.Length - 1).ToString();

            this.pnlDetails.Controls.Add(siNewLine);
            siNewLine.BringToFront();
            iLineRowIndex++;
        }
Ejemplo n.º 2
0
        private void HandleDescription(ref StockIssueLine slStockIssueLine)
        {
            if (slStockIssueLine.txtBatchNum.Text == "'")
            {
                slStockIssueLine.txtCode.ReadOnly = true;
                slStockIssueLine.txtDescription.ReadOnly = false;
                slStockIssueLine.txtQuantity.ReadOnly = true;
                slStockIssueLine.txtQuantity.Text = "0.00";
                slStockIssueLine.txtUnit.ReadOnly = true;
                slStockIssueLine.txtDescription.Focus();

                bAllowDuplicateLines = false;
            }
        }
Ejemplo n.º 3
0
        public void DBLoadStockIssueDetails(string sSINumber)
        {
            //Clear All Current Lines
            for (int iLines = 0; iLines < aStockIssueLines.Length; iLines++)
            {
                StockIssueLine silThisline = (((StockIssueLine)aStockIssueLines[iLines]));
                this.pnlDetails.Controls.Remove(silThisline);
            }

            //Reset Control
            iLineRowIndex = 0;
            aStockIssueLines = new Control[0];

            string sLineBatchNum = "";
            string sLineItemCode = "";
            string sLineDesc = "";
            string sLineUnit = "";

            decimal dLineQty = 0;

            if (txtNumber.Text != "*NEW*")
            {
                string sSql = "";

                using (PsqlConnection liqConn = new PsqlConnection(Connect.sConnStr))
                {
                    liqConn.Open();

                    sSql = "SELECT * FROM SOLSIL";
                    sSql += " WHERE DocNumber = '" + txtNumber.Text.Trim() + "'";

                    PsqlDataReader rdLineReader = Connect.getDataCommand(sSql, liqConn).ExecuteReader();

                    if (rdLineReader.HasRows)
                    {
                        while (rdLineReader.Read())
                        {
                            //Assign Values
                            sLineBatchNum = rdLineReader["BatchNumber"].ToString();
                            sLineItemCode = rdLineReader["ItemCode"].ToString();
                            sLineDesc = rdLineReader["Description"].ToString();
                            sLineUnit = rdLineReader["Unit"].ToString();

                            dLineQty = Convert.ToDecimal(rdLineReader["Qty"].ToString());

                            StockIssueLine silNewLine = new StockIssueLine();

                            silNewLine.txtBatchNum.Text = sLineBatchNum;
                            silNewLine.txtCode.Text = sLineItemCode;
                            silNewLine.txtDescription.Text = sLineDesc;
                            silNewLine.txtUnit.Text = sLineUnit;
                            silNewLine.txtQuantity.Text = dLineQty.ToString("N2");
                            silNewLine.txtQtyOnHand.Text = "N/A";

                            AddStockIssueLine(silNewLine);
                        }

                        rdLineReader.Close();
                    }

                    liqConn.Close();
                }
            }
        }
Ejemplo n.º 4
0
        public void focusNextLine(int iLineIndex)
        {
            //LL 17/09/2009 - start
            if ((iLineIndex >= aStockIssueLines.Length && txtNumber.Text == "*NEW*") || (iLineIndex >= aStockIssueLines.Length && txtNumber.Text == ""))
            {
                if (txtNumber.Text == "")
                    txtNumber.Text = "*NEW*";
                //LL 17/09/2009 - end

                StockIssueLine siNewLine = new StockIssueLine();
                AddStockIssueLine(siNewLine);
            }
            if (iLineIndex < aStockIssueLines.Length)
            {
                StockIssueLine siNewLine = (StockIssueLine)aStockIssueLines[iLineIndex];
                siNewLine.txtBatchNum.Focus();
            }
        }
Ejemplo n.º 5
0
        public void DeleteStockIssueLine(StockIssueLine slDeletedLine, bool bDeleteLastLine)
        {
            bool bDeleteControl = false;
            for (int iLines = 0; iLines < aStockIssueLines.Length; iLines++)
            {
                StockIssueLine silThisline = (((StockIssueLine)aStockIssueLines[iLines]));

                if (iLines != aStockIssueLines.Length - 1 || bDeleteLastLine) //Never delete the last row
                {
                    if (slDeletedLine.Name == silThisline.Name)
                    {
                        bDeleteControl = true;
                        this.pnlDetails.Controls.Remove(slDeletedLine);
                        if (iLines != aStockIssueLines.Length - 1)
                        {
                            (((StockIssueLine)aStockIssueLines[iLines + 1])).txtCode.Focus(); // focus on the next line
                        }
                    }
                    if (bDeleteControl && iLines != aStockIssueLines.Length - 1) //resize the line array
                    {
                        aStockIssueLines[iLines] = aStockIssueLines[iLines + 1]; //Move all the controls one up in the list
                        (((StockIssueLine)aStockIssueLines[iLines + 1])).Location = new Point((((StockIssueLine)aStockIssueLines[iLines + 1])).Location.X, (((StockIssueLine)aStockIssueLines[iLines + 1])).Location.Y - 20); // move location of control to new position
                        (((StockIssueLine)aStockIssueLines[iLines + 1])).iLineIndex--;//sync the lineindex of the control array
                    }
                }
            }

            if (bDeleteControl)//update the line array
            {
                Array.Resize<Control>(ref aStockIssueLines, aStockIssueLines.Length - 1);
                iLineRowIndex--;
            }
        }