public void AddDeliveryLine(ReturnNoteLine qlNewLine, bool bLoad) { if (!bLoad) { Array.Resize<Control>(ref aReturnNotelines, aReturnNotelines.Length + 1); aReturnNotelines[aReturnNotelines.Length - 1] = qlNewLine; if (iLineRowIndex < 20) qlNewLine.Top = 22 + ((iLineRowIndex) * 20); else qlNewLine.Top = 397; //16 + ((iLineRowIndex) * 18); qlNewLine.Left = 1; qlNewLine.TabIndex = 50 + aReturnNotelines.Length; qlNewLine.TabStop = true; qlNewLine.iLineIndex = aReturnNotelines.Length - 1; qlNewLine.Name = "qlNewLine_" + (aReturnNotelines.Length - 1).ToString(); this.pnlDetails.Controls.Add(qlNewLine); qlNewLine.BringToFront(); iLineRowIndex++; } else { Array.Resize<Control>(ref aReturnNotelines, aReturnNotelines.Length + 1); aReturnNotelines[aReturnNotelines.Length - 1] = qlNewLine; qlNewLine.Top = 22 + ((iLineRowIndex) * 20); qlNewLine.Left = 1; qlNewLine.TabIndex = 50 + aReturnNotelines.Length; qlNewLine.TabStop = true; qlNewLine.iLineIndex = aReturnNotelines.Length - 1; qlNewLine.Name = "qlNewLine_" + (aReturnNotelines.Length - 1).ToString(); this.pnlDetails.Controls.Add(qlNewLine); qlNewLine.BringToFront(); iLineRowIndex++; } }
private bool Populate_Inventory_Fields(ref ReturnNoteLine pdnDelivery, bool bFocusDescription) { if (pdnDelivery.txtCode.Text == "'") { pdnDelivery.txtDescription.ReadOnly = false; pdnDelivery.txtLastInvoiceDate.Text = ""; pdnDelivery.txtQuantity.ReadOnly = true; pdnDelivery.txtQuantity.Text = "0.00"; pdnDelivery.txtUnit.ReadOnly = true; pdnDelivery.txtDescription.Focus(); pdnDelivery.bDoCalculation = false; bAllowDuplicateLines = false; return true; } else if (!bNextLine) { bNextLine = true; ReturnNoteLine qlNewline = new ReturnNoteLine(); ((Forms.Project.ReturnNote)(Parent.Parent.Parent.Parent)).AddDeliveryLine(qlNewline,false); } return true; //bool bExist = false; //if (pdnDelivery.txtCode.Text == "'") //{ // pdnDelivery.txtDescription.ReadOnly = false; // pdnDelivery.txtLastInvoiceDate.Text = ""; // pdnDelivery.txtQuantity.ReadOnly = true; // pdnDelivery.txtQuantity.Text = "0.00"; // pdnDelivery.txtUnit.ReadOnly = true; // pdnDelivery.txtDescription.Focus(); // pdnDelivery.bDoCalculation = false; // bAllowDuplicateLines = false; // return true; //} //else //{ // pdnDelivery.txtQuantity.ReadOnly = false; // pdnDelivery.txtDescription.ReadOnly = false; // pdnDelivery.bDoCalculation = true; // if (!bNextLine) // { // bNextLine = true; // ReturnNoteLine qlNewline = new ReturnNoteLine(); // ((Forms.Project.ReturnNote)(Parent.Parent.Parent.Parent)).AddDeliveryLine(qlNewline); // } // bExist = true; // if (!bExist) // { // MessageBox.Show("Code does not exist.", "Inventory Not Found", MessageBoxButtons.OK, MessageBoxIcon.Warning); // pdnDelivery.txtDescription.ReadOnly = true; // return false; // } // else // { // } // return true; //} }
private void cmdCodeSearch_Click(object sender, EventArgs e) { Cursor = System.Windows.Forms.Cursors.WaitCursor; using (Finder.ReturnNoteItemZoom frmRetNoteItemZoom = new Finder.ReturnNoteItemZoom()) { //Sending "None" to inventory ShowDialog to identify that no workshop action should be taken string sDelNoteNr = ((Forms.Project.ReturnNote)(Parent.Parent.Parent.Parent)).txtDeliveryNote.Text; if (frmRetNoteItemZoom.ShowDialog(sDelNoteNr) == DialogResult.OK) { if (frmRetNoteItemZoom.ItemList[0] != "") { ItemList = frmRetNoteItemZoom.ItemList; if (ItemList.Count == 1) { foreach (string sItem in ItemList) { string[] aItemDetails = sItem.Split("|".ToCharArray()); txtCode.Text = aItemDetails[0].ToString(); txtDescription.Text = aItemDetails[1].ToString(); txtDelQty.Text = aItemDetails[2].ToString(); txtUnit.Text = aItemDetails[3].ToString(); ReturnNoteLine pdlReturnNote = this; ReturnNoteLine pdlLastControl = this; bool bValid = Populate_Inventory_Fields(ref pdlReturnNote, true); } } else { foreach (string sItem in ItemList) { string[] aItemDetails = sItem.Split("|".ToCharArray()); this.removeLine(null, null); //txtCode.Text = aItemDetails[0].ToString(); //txtDescription.Text = aItemDetails[1].ToString(); //txtQuoteQty.Text = aItemDetails[2].ToString(); //txtUnit.Text = aItemDetails[3].ToString(); //ProjectDeliveryNote pdlDeliveryNote = this; ReturnNoteLine pdlRetNote = new ReturnNoteLine(); pdlRetNote.txtCode.Text = aItemDetails[0].ToString(); pdlRetNote.txtDescription.Text = aItemDetails[1].ToString(); pdlRetNote.txtDelQty.Text = aItemDetails[2].ToString(); pdlRetNote.txtUnit.Text = aItemDetails[3].ToString(); //ProjectDeliveryNote pdlLastControl = this; //bool bValid = Populate_Inventory_Fields(ref pdlDeliveryNote, false, iLineIndex); ((Forms.Project.ReturnNote)(Parent.Parent.Parent.Parent)).AddDeliveryLine(pdlRetNote,true); } ReturnNoteLine pdlDelNoteNew = new ReturnNoteLine(); ((Forms.Project.ReturnNote)(Parent.Parent.Parent.Parent)).AddDeliveryLine(pdlDelNoteNew,true); ((Forms.Project.ReturnNote)(Parent.Parent.Parent.Parent)).deleteSalesLine(this, true); } //txtCode.Text = frmDelNoteItemZoom.sItemCode.Trim(); //txtDescription.Text = frmDelNoteItemZoom.sDescription.Trim(); //sQuoteNumber = frmDelNoteItemZoom.sQuoteNumber.Trim(); //ProjectDeliveryNote pdlDeliveryNote = this; //ProjectDeliveryNote pdlLastControl = this; //bool bValid = Populate_Inventory_Fields(ref pdlDeliveryNote, true); //txtCode.Focus(); //txtCode.SelectionStart = 0; //txtCode.SelectionLength = txtCode.Text.Length; } } } Cursor = System.Windows.Forms.Cursors.Default; }
private void LoadLines(string sItemCode, string sQty, string sDescription, string sLinkNum, string sUnit, string sMaxQty) { ReturnNoteLine qlNewLine = new ReturnNoteLine(); qlNewLine.bDoCalculation = false; qlNewLine.txtCode.Text = sItemCode; qlNewLine.txtUnit.Text = sUnit; qlNewLine.txtDescription.Text = sDescription; qlNewLine.txtQuantity.Text = sQty; qlNewLine.txtQuantity.ReadOnly = true; qlNewLine.txtDelQty.Text = sMaxQty; AddDeliveryLine(qlNewLine,true); qlNewLine.bDoCalculation = true; }
private void cmdNewLine_Click(object sender, EventArgs e) { ReturnNoteLine qlNewline = new ReturnNoteLine(); AddDeliveryLine(qlNewline,false); qlNewline.bNextLine = true; qlNewline.txtCode.Focus(); qlNewline.bFocusOnNextLine = false; }
public void focusNextLine(int iLineIndex) { //LL 17/09/2009 - start if ((iLineIndex >= aReturnNotelines.Length && txtNumber.Text == "*NEW*") || (iLineIndex >= aReturnNotelines.Length && txtNumber.Text == "")) { if (txtNumber.Text == "") txtNumber.Text = "*NEW*"; //LL 17/09/2009 - end ReturnNoteLine qlNewline = new ReturnNoteLine(); AddDeliveryLine(qlNewline,false); } if (iLineIndex < aReturnNotelines.Length) { ReturnNoteLine qlNewLine = (ReturnNoteLine)aReturnNotelines[iLineIndex]; qlNewLine.txtCode.Focus(); } }
public void deleteSalesLine(ReturnNoteLine qlDeletedLine, bool bDeleteLastLine) { bool bDeleteControl = false; for (int iLines = 0; iLines < aReturnNotelines.Length; iLines++) { ReturnNoteLine qlThisline = (((ReturnNoteLine)aReturnNotelines[iLines])); if (iLines != aReturnNotelines.Length - 1 || bDeleteLastLine) //Never delete the last row { if (qlDeletedLine.Name == qlThisline.Name) { bDeleteControl = true; this.pnlDetails.Controls.Remove(qlDeletedLine); if (iLines != aReturnNotelines.Length - 1) { (((ReturnNoteLine)aReturnNotelines[iLines + 1])).txtCode.Focus(); // focus on the next line } } if (bDeleteControl && iLines != aReturnNotelines.Length - 1) //resize the line array { aReturnNotelines[iLines] = aReturnNotelines[iLines + 1]; //Move all the controls one up in the list (((ReturnNoteLine)aReturnNotelines[iLines + 1])).Location = new Point((((ReturnNoteLine)aReturnNotelines[iLines + 1])).Location.X, (((ReturnNoteLine)aReturnNotelines[iLines + 1])).Location.Y - 20); // move location of control to new position (((ReturnNoteLine)aReturnNotelines[iLines + 1])).iLineIndex--;//sync the lineindex of the control array } } else if (bDeleteLastLine) { bDeleteControl = true; this.pnlDetails.Controls.Remove(qlDeletedLine); } } if (bDeleteControl)//update the line array { Array.Resize<Control>(ref aReturnNotelines, aReturnNotelines.Length - 1); iLineRowIndex--; } //Check if you want to close the order if (aReturnNotelines.Length == 0) { if (MessageBox.Show("There are no more lines in this order. Do you want to close this order?", "Close Order?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) { Functions.CloseOrder(txtNumber.Text.Trim()); } } }