Exemple #1
0
 private void cmdNewLine_Click_1(object sender, EventArgs e)
 {
     QouteLine qlNewline = new QouteLine();
     AddQouteLine(qlNewline,false);
     qlNewline.bNextLine = true;
     qlNewline.txtCode.Focus();
     qlNewline.bFocusOnNextLine = false;
 }
Exemple #2
0
        public void AddQouteLine(QouteLine qlNewLine, bool bLoad)
        {
            if (!bLoad)
            {
                Array.Resize<Control>(ref aQoutelines, aQoutelines.Length + 1);
                aQoutelines[aQoutelines.Length - 1] = qlNewLine;
                if (iLineRowIndex < 21)
                    qlNewLine.Top = 17 + ((iLineRowIndex) * 20);
                else
                    qlNewLine.Top = 408; //16 + ((iLineRowIndex) * 18);

                qlNewLine.Left = 4;

                qlNewLine.TabIndex = 50 + aQoutelines.Length;
                qlNewLine.TabStop = true;

                qlNewLine.iLineIndex = aQoutelines.Length - 1;
                qlNewLine.Name = "qlNewLine_" + (aQoutelines.Length - 1).ToString();

                this.pnlDetails.Controls.Add(qlNewLine);
                qlNewLine.BringToFront();
                iLineRowIndex++;
            }
            else
            {
                Array.Resize<Control>(ref aQoutelines, aQoutelines.Length + 1);
                aQoutelines[aQoutelines.Length - 1] = qlNewLine;
                qlNewLine.Top = 17 + ((iLineRowIndex) * 20);
                qlNewLine.Left = 4;
                qlNewLine.TabIndex = 50 + aQoutelines.Length;
                qlNewLine.TabStop = true;
                qlNewLine.iLineIndex = aQoutelines.Length - 1;
                qlNewLine.Name = "qlNewLine_" + (aQoutelines.Length - 1).ToString();
                this.pnlDetails.Controls.Add(qlNewLine);
                qlNewLine.BringToFront();
                iLineRowIndex++;

            }
        }
Exemple #3
0
        public void InsertQouteLine(int iLineIndex, QouteLine qlNewLine)
        {
            //for (int iLines = 0; iLines < aQoutelines.Length; iLines++)
            //{
            //    QouteLine qlThisline = (((QouteLine)aQoutelines[iLines]));

            //    if (qlThisline.iLineIndex == iLineIndex)//start line
            //    {
            //        Array.Resize<Control>(ref aQoutelines, aQoutelines.Length + 1);//Add new row
            //        iLineRowIndex++;
            //        for (int iShiftLines = aQoutelines.Length - 1; iShiftLines > iLines + 1; iShiftLines--)
            //        {
            //            aQoutelines[iShiftLines] = aQoutelines[iShiftLines - 1];
            //            (((QouteLine)aQoutelines[iShiftLines])).Location = new Point((((QouteLine)aQoutelines[iShiftLines - 1])).Location.X, (((QouteLine)aQoutelines[iShiftLines - 1])).Location.Y + 20); // move location of control to new position
            //            (((QouteLine)aQoutelines[iShiftLines])).iLineIndex++;//sync the lineindex of the control array
            //        }
            //        aQoutelines[iLines + 1] = qlNewLine;
            //        qlNewLine.Top = 17 + ((iLineIndex + 1) * 20);
            //        qlNewLine.Left = 4;

            //        qlNewLine.TabIndex = 50 + aQoutelines.Length;
            //        qlNewLine.TabStop = true;
            //        qlNewLine.iLineIndex = iLines + 1;
            //        qlNewLine.Name = "qlNewLine_" + (aQoutelines.Length - 1).ToString();
            //        this.pnlDetails.Controls.Add(qlNewLine);
            //        qlNewLine.BringToFront();
            //        return;
            //    }
            //}
        }
Exemple #4
0
 private void cmdNewLine_Click(object sender, EventArgs e)
 {
     QouteLine qlNewline = new QouteLine();
     AddQouteLine(qlNewline,false);
     qlNewline.bNextLine = true;
     qlNewline.txtCode.Focus();
     qlNewline.bFocusOnNextLine = false;
     //addUpdateInstruction(qlNewline.Name, 1, qlNewline, qlNewline.txtQuantity.Text, qlNewline.txtMultiplier.Text);
 }
Exemple #5
0
 public void focusNextLine(int iLineIndex)
 {
     //LL 17/09/2009 - start
     if ((iLineIndex >= aQoutelines.Length && txtNumber.Text == "*NEW*") || (iLineIndex >= aQoutelines.Length && txtNumber.Text == ""))
     {
         if (txtNumber.Text == "")
             txtNumber.Text = "*NEW*";
         //LL 17/09/2009 - end
         QouteLine qlNewline = new QouteLine();
         AddQouteLine(qlNewline,false);
     }
     if (iLineIndex < aQoutelines.Length)
     {
         QouteLine qlNewLine = (QouteLine)aQoutelines[iLineIndex];
         qlNewLine.txtCode.Focus();
     }
 }
Exemple #6
0
        public void deleteSalesLine(QouteLine qlDeletedLine, bool bDeleteLastLine)
        {
            bool bDeleteControl = false;
            for (int iLines = 0; iLines < aQoutelines.Length; iLines++)
            {
                QouteLine qlThisline = (((QouteLine)aQoutelines[iLines]));

                if (iLines != aQoutelines.Length - 1 || bDeleteLastLine) //Never delete the last row
                {
                    if (qlDeletedLine.Name == qlThisline.Name)
                    {
                        bDeleteControl = true;
                        this.pnlDetails.Controls.Remove(qlDeletedLine);
                        if (iLines != aQoutelines.Length - 1)
                        {
                            (((QouteLine)aQoutelines[iLines + 1])).txtCode.Focus(); // focus on the next line
                        }
                    }
                    if (bDeleteControl && iLines != aQoutelines.Length - 1) //resize the line array
                    {
                        aQoutelines[iLines] = aQoutelines[iLines + 1]; //Move all the controls one up in the list
                        (((QouteLine)aQoutelines[iLines + 1])).Location = new Point((((QouteLine)aQoutelines[iLines + 1])).Location.X, (((QouteLine)aQoutelines[iLines + 1])).Location.Y - 20); // move location of control to new position
                        (((QouteLine)aQoutelines[iLines + 1])).iLineIndex--;//sync the lineindex of the control array
                    }
                }
                else if (bDeleteLastLine)
                {
                    bDeleteControl = true;
                    this.pnlDetails.Controls.Remove(qlDeletedLine);
                    if (iLines != aQoutelines.Length - 1)
                    {
                        (((QouteLine)aQoutelines[iLines + 1])).txtCode.Focus(); // focus on the next line
                    }
                }
            }
            if (bDeleteControl)//update the line array
            {
                Array.Resize<Control>(ref aQoutelines, aQoutelines.Length - 1);
                iLineRowIndex--;
            }
            addTotals();
            //Check if you want to close the order
            if (aQoutelines.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());
                }
            }
        }
Exemple #7
0
        private void manageFrontEnd()
        {
            Control cntSelectedControl = this.ActiveControl;

            switch (cntSelectedControl.Name)
            {
                case "txtNumber":
                    if (txtNumber.Text == "")
                    {
                        cmdSearchNumber_Click(null, null);
                    }
                    else if (txtNumber.Text != "*NEW*")
                    {
                        loadQoute(txtNumber.Text);
                    }
                    else
                    {
                        txtCustomerCode.Focus();
                    }
                    break;
                case "txtCustomerCode":
                    if (txtCustomerCode.Text == "")
                    {
                        findCustomer(txtCustomerCode);
                        dtDate.Focus();
                    }
                    else
                    {
                        loadCustomer(false, false);
                        if (aQoutelines.Length == 0)
                        {
                            QouteLine qlNewLine = new QouteLine();
                            AddQouteLine(qlNewLine,false);
                        }
                    }
                    break;
                case "txtDelAd1":
                    txtDelAd2.Focus();
                    break;
                case "txtDelAd2":
                    txtDelAd3.Focus();
                    break;
                case "txtDelAd3":
                    txtDelAd4.Focus();
                    break;
                case "txtDelAd4":
                    txtDelAd5.Focus();
                    break;
                case "txtDelAd5":
                    txtContact.Focus();
                    break;
                case "txtContact":
                    txtTelephone.Focus();
                    break;
                case "txtTelephone":
                    txtFax.Focus();
                    break;
                case "txtFax":
                    txtMobile.Focus();
                    break;
                case "txtMobile":
                    txtEmail.Focus();
                    break;
                case "txtEmail":
                    dtDate.Focus();
                    break;
                //LL Phalaborwa
                case "selAddresses":
                    dtDate.Focus();
                    break;
                //LL end

                case "dtDate":
                    txtSalesCode.Focus();
                    break;
                case "txtSalesCode":
                    txtDiscount.Focus();
                    break;
                case "cmdSalesPerson":
                    txtDiscount.Focus();
                    break;
                case "txtDiscount":
                    dtExpiryDate.Focus();
                    break;
                case "dtExpiryDate":
                    txtCustomerRef.Focus();
                    break;
                case "txtCustomerRef":
                    focusNextLine(0);
                    break;
                case "txtNotes":
                    txtNotes.Text += "\r\n";
                    int i = txtNotes.Text.Length;
                    txtNotes.SelectionStart = i;
                    txtNotes.Focus();
                    break;
                case "txtQouteNotes":
                    txtQouteNotes.Text += "\r\n";
                    int i2 = txtQouteNotes.Text.Length;
                    txtQouteNotes.SelectionStart = i2;
                    txtQouteNotes.Focus();
                    break;

            }
        }
Exemple #8
0
        private void LoadLines(string sItemCode, string sMultiplier, string sQty,string sExclPrice, string sDescription, string sDisc, string sLinkNum, string sUnit)
        {
            QouteLine qlNewLine = new QouteLine();
            qlNewLine.bDoCalculation = false;
            qlNewLine.txtCode.Text = sItemCode;
            qlNewLine.txtUnit.Text = sUnit;
            qlNewLine.txtDiscount.Text = sDisc;
            qlNewLine.txtExcPrice.Text = sExclPrice;
            qlNewLine.txtDescription.Text = sDescription;
            //qlNewLine.cmdCodeSearch.Visible = false;
            //qlNewLine.txtExcPrice.ReadOnly = true;
            //qlNewLine.txtMultiplier.Text = sMultiplier;
            qlNewLine.txtQuantity.Text = sQty;
            if (pnlStatus.BackColor == Color.LimeGreen)
                qlNewLine.txtQuantity.ReadOnly = true;

            decimal dQty = Convert.ToDecimal(sMultiplier) * Convert.ToDecimal(sQty);
            double dTotalExDiscount = Convert.ToDouble(dQty) * Convert.ToDouble(qlNewLine.txtExcPrice.Text.Replace(",", ""));
            qlNewLine.txtNet.Text = (dTotalExDiscount - (dTotalExDiscount * (Convert.ToDouble(qlNewLine.txtDiscount.Text.Replace(",", "")) / 100))).ToString("N2");
            AddQouteLine(qlNewLine,true);
            qlNewLine.bDoCalculation = true;
        }
Exemple #9
0
        private bool Populate_Inventory_Fields(ref QouteLine qlQouteLine, bool bFocusDescription)
        {
            string sInventoryGroup = "";
            bool bExist = false;
            if (qlQouteLine.txtCode.Text == "'")
            {
                //qlQouteLine.txtMultiplier.ReadOnly = true;
                qlQouteLine.txtDescription.ReadOnly = false;
                qlQouteLine.txtDiscount.ReadOnly = true;
                qlQouteLine.txtExcPrice.ReadOnly = true;
                qlQouteLine.txtLastInvoiceDate.Text = "";
                qlQouteLine.txtNet.ReadOnly = true;
                qlQouteLine.txtQuantity.ReadOnly = true;
                qlQouteLine.txtUnit.ReadOnly = true;
                qlQouteLine.txtDescription.Focus();
                qlQouteLine.bDoCalculation = false;
                bAllowDuplicateLines = false;
                return true;
            }
            else
            {
                //qlQouteLine.txtMultiplier.ReadOnly = false;
                qlQouteLine.txtDiscount.ReadOnly = false;
                qlQouteLine.txtExcPrice.ReadOnly = false;
                qlQouteLine.txtQuantity.ReadOnly = false;
                qlQouteLine.txtDescription.ReadOnly = false;

                qlQouteLine.bDoCalculation = true;
                using (PsqlConnection oConn = new PsqlConnection(Solsage_Process_Management_System.Classes.Connect.sPastelConnStr))
                {
                    oConn.Open();
                    string sSql = "SELECT distinct  Inventory.*, MultiStoreTrn.SellExcl01 from Inventory left join MultiStoreTrn on Inventory.ItemCode = MultiStoreTrn.ItemCode";
                    sSql += " where Inventory.ItemCode = '" + qlQouteLine.txtCode.Text.Trim() + "'";
                    sSql += " AND MultiStoreTrn.StoreCode <> ''";

                    PsqlDataReader rdReader = Solsage_Process_Management_System.Classes.Connect.getDataCommand(sSql, oConn).ExecuteReader();
                    while (rdReader.Read())
                    {

                        if (!bNextLine)
                        {
                            bNextLine = true;
                            QouteLine qlNewline = new QouteLine();
                            ((Forms.Qoutes.Qoute)(Parent.Parent.Parent.Parent)).AddQouteLine(qlNewline,false);

                        }
                        qlQouteLine.txtDescription.Text = rdReader["Description"].ToString().Trim();

                        try
                        {
                            qlQouteLine.txtExcPrice.Text = Convert.ToDecimal(rdReader["SellExcl01"].ToString()).ToString("N2");
                            dOriginalUnitPrice = Convert.ToDecimal(rdReader["SellExcl01"].ToString());
                        }
                        catch
                        {
                            MessageBox.Show("Error calculating Excluding Price of item.");
                            qlQouteLine.txtExcPrice.Text = "0.00";
                        }
                        qlQouteLine.txtTaxType.Text = rdReader["SalesTaxType"].ToString().Trim();
                        qlQouteLine.txtDiscountType.Text = rdReader["DiscountType"].ToString().Trim();

                        qlQouteLine.sLineType = Functions.getLineInventoryType(qlQouteLine.txtCode.Text.Trim());

                        if (qlQouteLine.txtTaxType.Text == "0" || qlQouteLine.txtTaxType.Text == "2")
                        {
                            qlQouteLine.txtNet.BackColor = Color.Yellow;
                        }
                        else
                        {
                            qlQouteLine.txtNet.BackColor = Color.White;
                        }

                        if (rdReader["DiscountType"].ToString() == "0" || rdReader["DiscountType"].ToString() == "1")//AJD 20-08-2009
                        {
                            qlQouteLine.txtDiscount.ReadOnly = true;
                        }
                        qlQouteLine.txtUnit.Text = rdReader["UnitSize"].ToString();
                        qlQouteLine.txtDescription.Focus();
                        bExist = true;

                    }//end while
                    rdReader.Close();
                    oConn.Dispose();
                    if (!bExist)
                    {

                        MessageBox.Show("Code does not exist.", "Inventory Not Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        qlQouteLine.txtDescription.ReadOnly = true;
                        return false;
                    }
                    else
                    {

                    }
                    return true;
                }
            }
        }