Ejemplo n.º 1
0
        private void Inv_Send_Edit_Del_Load(object sender, EventArgs e)
        {
            Home frmHome = (Home)this.Owner;

            if (frmHome.GetCurPanel() == "pnl_L_InvSent")
            {
                Invoices_Send curForm = (Invoices_Send)frmHome.GetCurForm();

                dt = curForm.GetInvoices();

                txt_ISED_CCode.Text = curForm.GetCCode();
                txt_ISED_CName.Text = curForm.GetCName();

                SELECTED_INVOICE = curForm.GetSelectedInvSend();
            }
            else
            {
                isInter = true;
                Int_Invoices_Send curForm = (Int_Invoices_Send)frmHome.GetCurForm();

                dt = curForm.GetInvoices();

                txt_ISED_CCode.Text = curForm.GetCCode();
                txt_ISED_CName.Text = curForm.GetCName();

                SELECTED_INVOICE = curForm.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();
            }
        }
Ejemplo n.º 2
0
        //================================================================================================================================================//
        // INVOICES SENT ADD FORM LOAD                                                                                                                    //
        //================================================================================================================================================//
        private void Inv_Send_Add_Load(object sender, EventArgs e)
        {
            Home frmHome = (Home)this.Owner;

            if (frmHome.GetCurPanel() == "pnl_L_InvSent")
            {
                parent = (Invoices_Send)frmHome.GetCurForm();

                txt_ISA_CCode.Text = parent.GetCCode();
                txt_ISA_CName.Text = parent.GetCName();

                txt_ISA_Amt.Text           = "R0.00";
                txt_ISA_Amt.SelectionStart = txt_ISA_Amt.Text.Length;

                txt_ISA_VAT.Text           = "R0.00";
                txt_ISA_VAT.SelectionStart = txt_ISA_VAT.Text.Length;

                dt = parent.GetInvoices();
            }
            else
            {
                isInter   = true;
                intParent = (Int_Invoices_Send)frmHome.GetCurForm();

                txt_ISA_CCode.Text = intParent.GetCCode();
                txt_ISA_CName.Text = intParent.GetCName();

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

                txt_ISA_VAT.Text           = "$0.00";
                txt_ISA_VAT.SelectionStart = txt_ISA_VAT.Text.Length;

                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");

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