private void btn_Search_Click(object sender, EventArgs e) { VendorSearch search = new VendorSearch(); search.ApplyCredits = "Credits"; search.ShowDialog(); if (search.selectedVendorCode != null) { if (search.selectedVendorCode != "") { txt_VendorCode.Text = search.selectedVendorCode; DataRow rc; dtInvoice.Clear(); DataRow[] drs = dbAccountingProjectDS.APTrans.Select("VendorCode = '" + search.selectedVendorCode + "' AND TransactionType = 'Invoice' and MultiCurrency = 0 and Paid = 0 ", "InvoiceDate"); if (drs.Length != 0) { for (int i = 0; i < drs.Length; i++) { rc = dtInvoice.NewRow(); rc["InvoiceID"] = int.Parse(drs[i]["BatchInvoiceID"].ToString()); rc["Select"] = false; rc["VendorCode"] = drs[i]["VendorCode"].ToString(); rc["InvoiceDate"] = Convert.ToDateTime(drs[i]["InvoiceDate"].ToString()); rc["Reference"] = drs[i]["Reference"].ToString(); rc["InvoiceAmount"] = double.Parse(drs[i]["InvoiceAmount"].ToString()); rc["TaxValue"] = double.Parse(drs[i]["TaxValue"].ToString()); rc["AmountPaid"] = double.Parse(drs[i]["AmountPaid"].ToString()); rc["Balance"] = double.Parse(drs[i]["InvoiceAmount"].ToString()) - double.Parse(drs[i]["TaxValue"].ToString()) - double.Parse(drs[i]["AmountPaid"].ToString()); rc["AmtApplied"] = 0; rc["AppliedBalance"] = double.Parse(drs[i]["InvoiceAmount"].ToString()) - double.Parse(drs[i]["TaxValue"].ToString()) - double.Parse(drs[i]["AmountPaid"].ToString()); rc["Curr."] = drs[i]["CurrencyCode"].ToString(); dtInvoice.Rows.Add(rc); } dgv_AccountCharges.Refresh(); } for (int c = 0; c < dgv_AccountCharges.ColumnCount - 1; c++) { dgv_AccountCharges.Columns[c].SortMode = DataGridViewColumnSortMode.NotSortable; } } } }
private void vendorSearchToolStripMenuItem_Click(object sender, EventArgs e) { VendorSearch vendorsearch = new VendorSearch(); vendorsearch.ShowDialog(); }
private void btn_Search_Click(object sender, EventArgs e) { DataRow[] drs = dbAccountingProjectDS.APTrans.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("BatchNo IN " + NOBatches + " 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 == "VendorCode") { if (NOBatches.Trim() == "") { NOBatches = " (-1)"; } drs = dbAccountingProjectDS.APTrans.Select("TransactionType = 'CreditNote' AND APBatchNumber IN " + NOBatches + ""); VendorSearch search = new VendorSearch(); if (drs.Length != 0) { search.NOSearch = ""; s = ""; foreach (DataRow r in drs) { search.NOSearch = search.NOSearch + s + r["VendorCode"].ToString() + "'"; s = ",'"; } search.NOSearch = "('" + search.NOSearch + ")"; } search.ApplyCredits = "Credits"; search.ShowDialog(); if (search.selectedVendorCode != null) { txt_Mode.Text = search.selectedVendorCode; FindTransactions(); } } if (applyMode == "Batch") { SearchAP search = new SearchAP(); if (drs.Length != 0) { search.NOSearch = ""; s = ""; foreach (DataRow r in drs) { search.NOSearch = search.NOSearch + s + r["APBatchNumber"].ToString() + "'"; s = ",'"; } search.NOSearch = "('" + search.NOSearch + ")"; } search.ApplyCredits = "Credits"; search.ShowDialog(); if (search.selectAPNumber != null) { txt_Mode.Text = search.selectAPNumber; FindTransactions(); } } }
private void btnVendorSearch_Click(object sender, EventArgs e) { VendorSearch vendorsearch = new VendorSearch(); vendorsearch.ShowDialog(); }