コード例 #1
0
ファイル: SalesOrder.cs プロジェクト: anthonied/LiquidPastel
        public void InsertSalesLine(int iLineIndex, SalesLine slNewLine)
        {
            for (int iLines = 0; iLines < aSaleslines.Length; iLines++)
            {
                SalesLine slThisline = (((SalesLine)aSaleslines[iLines]));

                if (slThisline.iLineIndex == iLineIndex)//start line
                {
                    Array.Resize<Control>(ref aSaleslines, aSaleslines.Length + 1);//Add new row
                    iLineRowIndex++;
                    for (int iShiftLines = aSaleslines.Length-1; iShiftLines > iLines+1; iShiftLines--)
                    {
                        aSaleslines[iShiftLines] = aSaleslines[iShiftLines - 1];
                        (((SalesLine)aSaleslines[iShiftLines])).Location = new Point((((SalesLine)aSaleslines[iShiftLines-1])).Location.X, (((SalesLine)aSaleslines[iShiftLines-1])).Location.Y + 20); // move location of control to new position
                        (((SalesLine)aSaleslines[iShiftLines])).iLineIndex++;//sync the lineindex of the control array
                    }
                    aSaleslines[iLines + 1] = slNewLine;
                    slNewLine.Top = 17 + ((iLineIndex+1) * 20);
                    slNewLine.Left = 4;
                    if (slNewLine.txtStore.Text == "")
                    {
                        slNewLine.txtStore.Text = Global.sDefaultStore;
                    }
                    slNewLine.TabIndex = 50 + aSaleslines.Length;
                    slNewLine.TabStop = true;
                    slNewLine.iLineIndex = iLines + 1;
                    slNewLine.Name = "slNewLine_" + (aSaleslines.Length - 1).ToString();
                    this.pnlDetails.Controls.Add(slNewLine);
                    slNewLine.BringToFront();
                    return;
                }
            }
        }
コード例 #2
0
ファイル: SalesOrder.cs プロジェクト: anthonied/LiquidPastel
        public void AddSalesLine(SalesLine slNewLine)
        {
            slNewLine.chkReturn.Enabled = true;

            if (slNewLine.bInsertInMiddle == false)
            {
                Array.Resize<Control>(ref aSaleslines, aSaleslines.Length + 1);
                aSaleslines[aSaleslines.Length - 1] = slNewLine;

                if (iLineRowIndex < 14)
                    slNewLine.Top = 17 + ((iLineRowIndex) * 20);
                else
                    slNewLine.Top = 268; //16 + ((iLineRowIndex) * 18);
                slNewLine.Left = 4;
                if (slNewLine.txtStore.Text == "")
                {
                    slNewLine.txtStore.Text = Global.sDefaultStore;
                }
                slNewLine.TabIndex = 50 + aSaleslines.Length;
                slNewLine.TabStop = true;

                slNewLine.iLineIndex = aSaleslines.Length - 1;
                slNewLine.Name = "slNewLine_" + (aSaleslines.Length - 1).ToString();

                //enable chkreturn according to user rights
                if (Global.sInvoiceTemplate == "Talisman - Wonderboom")
                {
                    if (Global.iReturnItem == 1)
                    {
                        slNewLine.chkReturn.Enabled = true;
                    }
                    else
                    {
                        slNewLine.chkReturn.Enabled = false;
                    }
                }

                this.pnlDetails.Controls.Add(slNewLine);
                slNewLine.BringToFront();
                iLineRowIndex++;
            }
            else
            {
                Array.Resize<Control>(ref aSaleslines, aSaleslines.Length + 1);
                aSaleslines[aSaleslines.Length - 1] = slNewLine;

                if (iLineRowIndex < 14)
                    slNewLine.Top = 17 + ((Convert.ToInt16(slNewLine.sPastelLineLink) - 1) * 20);
                else
                    slNewLine.Top = 268; //16 + ((iLineRowIndex) * 18);
                slNewLine.Left = 4;
                if (slNewLine.txtStore.Text == "")
                {
                    slNewLine.txtStore.Text = Global.sDefaultStore;
                }
                slNewLine.TabIndex = 50 + aSaleslines.Length;
                slNewLine.TabStop = true;

                slNewLine.iLineIndex = Convert.ToInt16(slNewLine.sPastelLineLink) - 1;
                slNewLine.Name = "slNewLine_" + (aSaleslines.Length - 1).ToString();

                //enable chkreturn according to user rights
                if (Global.sInvoiceTemplate == "Talisman - Wonderboom")
                {
                    if (Global.iReturnItem == 1)
                    {
                        slNewLine.chkReturn.Enabled = true;
                    }
                    else
                    {
                        slNewLine.chkReturn.Enabled = false;
                    }
                }

                this.pnlDetails.Controls.Add(slNewLine);
                slNewLine.BringToFront();
                iLineRowIndex++;

            }
        }