Example #1
0
        private void txtARCode_DoubleClick(object sender, EventArgs e)
        {
            SearchCustomer search = new SearchCustomer();

            search.ShowDialog();
            if (search.selectedAccountCode != null && search.selectedAccountCode != "")
            {
                txtARCode.Text = search.selectedAccountCode;
            }
        }
Example #2
0
        private void btn_Search_Click(object sender, EventArgs e)
        {
            DataRow[] drs;
            // drs = dbAccountingProjectDS.ARtrans.Select("TransactionType = 'CreditNote'");
            string NOBatches = "";
            string s         = "";

            //if (drs.Length != 0)
            //{

            //    foreach (DataRow r in drs)
            //    {
            //        NOBatches = NOBatches + s + r["APBatchNumber"].ToString() + "'";
            //        s = ",'";
            //    }
            //    NOBatches = "('" + NOBatches + ")";
            //}
            DataRow[] drb = dbAccountingProjectDS.Batch.Select("BatchSRC = 'ARP' AND BatchStat = 'P'");
            NOBatches = "";
            s         = "";
            if (drb.Length != 0)
            {
                foreach (DataRow r in drb)
                {
                    NOBatches = NOBatches + s + r["BatchNo"].ToString() + "'";
                    s         = ",'";
                }
                NOBatches = "('" + NOBatches + ")";
            }
            if (applyMode == "AccountCode")
            {
                if (NOBatches == "")
                {
                    if (NOTranARCredit != "")
                    {
                        drs = dbAccountingProjectDS.ARtrans.Select(" ( Paid = 'N' AND BatchNo IN (0) ) OR  ( Paid = 'N' AND TransNO IN " + NOTranARCredit + ")");
                    }
                    else
                    {
                        drs = dbAccountingProjectDS.ARtrans.Select(" Paid = 'N' AND BatchNo IN (0)");
                    }
                }
                else
                {
                    if (NOTranARCredit != "")
                    {
                        drs = dbAccountingProjectDS.ARtrans.Select(" ( Paid = 'N' AND BatchNo IN " + NOBatches + " ) OR  ( Paid = 'N' AND TransNO IN " + NOTranARCredit + ")");
                    }
                    else
                    {
                        drs = dbAccountingProjectDS.ARtrans.Select(" Paid = 'N' AND BatchNo IN " + NOBatches);
                    }
                }
                SearchCustomer search = new SearchCustomer();
                if (drs.Length != 0)
                {
                    search.NOSearch = "";
                    s = "";
                    foreach (DataRow r in drs)
                    {
                        search.NOSearch = search.NOSearch + s + r["AccountCode"].ToString() + "'";
                        s = ",'";
                    }
                    search.NOSearch = "('" + search.NOSearch + ")";
                }
                search.ApplyCredits = "Credits";
                search.ShowDialog();
                if (search.selectedAccountCode != null && search.selectedAccountCode != "")
                {
                    txt_Mode.Text = search.selectedAccountCode;
                    FindTransactions();
                }
            }
            if (applyMode == "Batch")
            {
                if (NOBatchesARP == "")
                {
                    if (NOTranARCredit != "")
                    {
                        drs = dbAccountingProjectDS.ARtrans.Select(" ( Paid = 'N' AND BatchNo IN (0) ) OR ( Paid = 'N' AND TransNO IN " + NOTranARCredit + ")");
                    }
                    else
                    {
                        drs = dbAccountingProjectDS.ARtrans.Select(" Paid = 'N' AND BatchNo IN (0)");
                    }
                }
                else
                {
                    if (NOTranARCredit != "")
                    {
                        drs = dbAccountingProjectDS.ARtrans.Select(" ( Paid = 'N' AND BatchNo IN " + NOBatchesARP + " ) OR ( Paid = 'N' AND TransNO IN " + NOTranARCredit + ")");
                    }
                    else
                    {
                        drs = dbAccountingProjectDS.ARtrans.Select(" Paid = 'N' AND BatchNo IN " + NOBatchesARP);
                    }
                }
                SearchAR search = new SearchAR();
                if (drs.Length != 0)
                {
                    search.NOSearch = "";
                    s = "";
                    foreach (DataRow r in drs)
                    {
                        search.NOSearch = search.NOSearch + s + r["BatchNo"].ToString() + "'";
                        s = ",'";
                    }
                    search.NOSearch = "('" + search.NOSearch + ")";
                }

                search.ApplyCredits = "Credits";
                search.ShowDialog();
                if (search.selectARNumber != null && search.selectARNumber != "")
                {
                    txt_Mode.Text = search.selectARNumber;
                    FindTransactions();
                }
            }
        }