private void Inv_Send_Edit_Del_Load(object sender, EventArgs e)
        {
            if (this.Owner.GetType() == typeof(Invoices_Send))
            {
                Invoices_Send owner = (Invoices_Send)this.Owner;

                dt = owner.GetInvoices();

                txt_ISED_CCode.Text = owner.GetClientCode();
                txt_ISED_CName.Text = owner.GetClientName();

                SELECTED_INVOICE = owner.GetSelectedInvSend();
            }
            else
            {
                Int_Invoices_Send owner = (Int_Invoices_Send)this.Owner;

                dt = owner.GetInvoices();

                txt_ISED_CCode.Text = owner.GetClientCode();
                txt_ISED_CName.Text = owner.GetClientName();

                SELECTED_INVOICE = owner.GetSelectedInvSend();
            }

            LoadInvSend();

            if (txt_ISED_INInst.Text.Trim() != string.Empty)
            {
                oldINum = txt_ISED_InvNum.Text.Trim() + "." + txt_ISED_INInst.Text.Trim();
            }
            else
            {
                oldINum = txt_ISED_InvNum.Text.Trim();
            }
        }
Beispiel #2
0
        private void Inv_Send_Add_Load(object sender, EventArgs e)
        {
            if (this.Owner.GetType() == typeof(Invoices_Send))
            {
                parent = (Invoices_Send)this.Owner;

                txt_ISA_CCode.Text = parent.GetClientCode();
                txt_ISA_CName.Text = parent.GetClientName();

                dt = parent.GetInvoices();
            }
            else
            {
                intParent = (Int_Invoices_Send)this.Owner;

                txt_ISA_CCode.Text = intParent.GetClientCode();
                txt_ISA_CName.Text = intParent.GetClientName();

                dt = intParent.GetInvoices();
            }

            int newInvNum = 0;

            foreach (DataRow row in (InternalDataCollectionBase)dt.Rows)
            {
                if (row.RowState == DataRowState.Deleted)
                {
                    string curInvNum = row["Invoice_Number", DataRowVersion.Original].ToString().Trim();

                    if (!curInvNum.Contains("."))
                    {
                        int pos   = curInvNum.IndexOf("_");
                        int int32 = Convert.ToInt32(curInvNum.Remove(0, pos + 2));
                        if (int32 > newInvNum)
                        {
                            newInvNum = int32;
                        }
                    }
                    else
                    {
                        int pos = curInvNum.IndexOf("_");
                        curInvNum = curInvNum.Remove(0, pos + 2);

                        pos = curInvNum.IndexOf(".");
                        int int32 = Convert.ToInt32(curInvNum.Remove(pos, curInvNum.Length - 3));
                        if (int32 > newInvNum)
                        {
                            newInvNum = int32;
                        }
                    }
                }
                else
                {
                    string curInvNum = row["Invoice_Number"].ToString().Trim();

                    if (!curInvNum.Contains("."))
                    {
                        int pos   = curInvNum.IndexOf("_");
                        int int32 = Convert.ToInt32(curInvNum.Remove(0, pos + 2));
                        if (int32 > newInvNum)
                        {
                            newInvNum = int32;
                        }
                    }
                    else
                    {
                        int pos = curInvNum.IndexOf("_");
                        curInvNum = curInvNum.Remove(0, pos + 2);

                        pos = curInvNum.IndexOf(".");
                        int int32 = Convert.ToInt32(curInvNum.Remove(pos, curInvNum.Length - 3));
                        if (int32 > newInvNum)
                        {
                            newInvNum = int32;
                        }
                    }
                }
            }

            txt_ISA_InvNum.Text = txt_ISA_CCode.Text + "_I" + (newInvNum + 1).ToString("000");


            txt_ISA_Amt.Text           = "0.00";
            txt_ISA_Amt.SelectionStart = txt_ISA_Amt.Text.Length;

            txt_ISA_VAT.Text           = ddb_InvSendCur.selectedValue + " " + "0.00";
            txt_ISA_VAT.SelectionStart = txt_ISA_VAT.Text.Length;

            dtp_ISA_Date.Value     = DateTime.Now;
            dtp_ISA_DatePaid.Value = DateTime.Now;
        }