private void addGridRows() { string str = ""; for (int i = 0; i < Headers.Length; i++) { switch (i) { case 0: str = POPIHeaderDB.getPOPIDtlsForProjectTrans(txtProjectID.Text); break; case 1: str = WorkOrderDB.getWODtlsForProjectTrans(txtProjectID.Text); break; case 2: str = InvoiceOutHeaderDB.getIOHDtlsForProjectTrans(txtProjectID.Text); break; case 3: str = PaymentVoucherDB.getPVHDtlsForProjectTrans(txtProjectID.Text, 1); break; case 4: str = PaymentVoucherDB.getPVHDtlsForProjectTrans(txtProjectID.Text, 2); break; case 5: str = ""; break; case 6: str = PaymentVoucherDB.getPVHDtlsForProjectTrans(txtProjectID.Text, 3); break; case 7: str = ReceiptVoucherDB.getRVDtlsForProjectTrans(txtProjectID.Text); break; default: break; } if (str.Length != 0) { grdMainList.Rows.Add(); grdMainList.Rows[grdMainList.RowCount - 1].Cells["Received"].Value = Headers[i]; grdMainList.Rows[grdMainList.RowCount - 1].Cells["gNo"].Value = str.Substring(0, str.IndexOf('-')); grdMainList.Rows[grdMainList.RowCount - 1].Cells["Value"].Value = str.Substring(str.IndexOf('-') + 1); } else { grdMainList.Rows.Add(); grdMainList.Rows[grdMainList.RowCount - 1].Cells["Received"].Value = Headers[i]; grdMainList.Rows[grdMainList.RowCount - 1].Cells["gNo"].Value = "0"; grdMainList.Rows[grdMainList.RowCount - 1].Cells["Value"].Value = "0"; } } }
private void btnView_Click(object sender, EventArgs e) { try { AddGrdListRows(); DateTime dt = UpdateTable.getSQLDateTime(); if (txtBankCode.Text.Trim().Length == 0 || dtRecDate.Value > dt || dtRecDate.Value < FYStartTIme) { MessageBox.Show("Fill Bank Ac code or Date Properly"); return; } decimal bookbal = LedgerDB.getTotalBookBalanceOfBankAc(FYStartTIme, dtRecDate.Value, txtBankCode.Text); decimal TotDr = 0; decimal TotCr = 0; if (bookbal < 0) { grdList.Rows[0].Cells["Credit"].Value = bookbal * (-1); TotCr = bookbal * (-1); } else { grdList.Rows[0].Cells["Debit"].Value = bookbal; TotDr = bookbal; } grdList.Rows[1].Cells["Debit"].Value = ReceiptVoucherDB.getTotalNotClearedDepositeOfBankAcForBRReport(FYStartTIme, dtRecDate.Value, txtBankCode.Text); TotDr = TotDr + Convert.ToDecimal(grdList.Rows[1].Cells["Debit"].Value); grdList.Rows[2].Cells["Credit"].Value = PaymentVoucherDB.getTotalNotClearedPaymentOfBankAcForBRReport(FYStartTIme, dtRecDate.Value, txtBankCode.Text); TotCr = TotCr + Convert.ToDecimal(grdList.Rows[2].Cells["Credit"].Value); //string str = grdList.Rows[3].Cells["Credit"].Value.ToString(); decimal tot = TotDr - TotCr; if (tot < 0) { grdList.Rows[3].Cells["Credit"].Value = tot; } else { grdList.Rows[3].Cells["Debit"].Value = tot; } grdList.Visible = true; grdVoucherList.Rows.Clear(); grdVoucherList.Visible = false; btnClose.Visible = false; } catch (Exception ex) { } }
private void ShowAllDetails() { try { if (docID == "CASHPAYMENTVOUCHER" || docID == "BANKPAYMENTVOUCHER") { grdPRDetail.Columns["PartyCode"].Visible = false; grdPRDetail.Columns["PartyName"].Visible = false; grdPRDetail.Columns["SLType"].Visible = false; grdPRDetail.Columns["ChequeNo"].Visible = true; grdPRDetail.Columns["ChequeDate"].Visible = true; paymentvoucher vh = new paymentvoucher(); vh.DocumentID = docID; vh.VoucherNo = voucherNo; vh.VoucherDate = voucherDate; paymentvoucher pvh = PaymentVoucherDB.getVoucherHeaderForTrialBalance(vh); txtTemporarryNo.Text = pvh.TemporaryNo.ToString(); dtTempDate.Value = pvh.TemporaryDate; txtVoucherNo.Text = pvh.VoucherNo.ToString(); dtVoucherDate.Value = pvh.VoucherDate; txtvoucherType.Text = pvh.VoucherType; cmbBookType.SelectedIndex = Structures.ComboFUnctions.getComboIndex(cmbBookType, pvh.BookType); txtPayeeCode.Text = pvh.SLCode.ToString(); txtPayeeName.Text = pvh.SLName; txtBillDetails.Text = pvh.BillDetails; cmbBankTransMode.SelectedIndex = Structures.ComboFUnctions.getComboIndex(cmbBankTransMode, pvh.BankTransactionMode); cmbOfficeID.SelectedIndex = Structures.ComboFUnctions.getComboIndex(cmbOfficeID, pvh.OfficeID); cmbProjectID.SelectedIndex = cmbProjectID.FindString(pvh.ProjectID); cmbCurrencyID.SelectedIndex = Structures.ComboFUnctions.getComboIndex(cmbCurrencyID, pvh.CurrencyID); txtExchangeRate.Text = pvh.ExchangeRate.ToString(); txtVoucherAmount.Text = pvh.VoucherAmount.ToString(); txtvoucherAmountINR.Text = pvh.VoucherAmountINR.ToString(); txtAmountInWords.Text = NumberToString.convert(pvh.VoucherAmount.ToString()).Trim().Replace("INR", pvh.CurrencyID); txtnarration.Text = pvh.Narration.ToString(); List <paymentvoucherdetail> VDetail = PaymentVoucherDB.getVoucherDetail(pvh); grdPRDetail.Rows.Clear(); int i = 0; decimal totCredit = 0; decimal totDebit = 0; foreach (paymentvoucherdetail vd in VDetail) { AddPRDetailRow(); grdPRDetail.Rows[i].Cells["AccountCode"].Value = vd.AccountCode; grdPRDetail.Rows[i].Cells["AccountName"].Value = vd.AccountName; grdPRDetail.Rows[i].Cells["AmountDebit"].Value = vd.AmountDebit; totDebit = totDebit + vd.AmountDebit; grdPRDetail.Rows[i].Cells["AmountCredit"].Value = vd.AmountCredit; totCredit = totCredit + vd.AmountCredit; grdPRDetail.Rows[i].Cells["ChequeNo"].Value = vd.ChequeNo; grdPRDetail.Rows[i].Cells["ChequeDate"].Value = vd.ChequeDate; i++; } txtTotalCreditAmnt.Text = totCredit.ToString(); txtTotalDebitAmnt.Text = totDebit.ToString(); } else if (docID == "BANKRECEIPTVOUCHER" || docID == "CASHRECEIPTVOUCHER") { grdPRDetail.Columns["PartyCode"].Visible = false; grdPRDetail.Columns["PartyName"].Visible = false; grdPRDetail.Columns["SLType"].Visible = false; grdPRDetail.Columns["ChequeNo"].Visible = true; grdPRDetail.Columns["ChequeDate"].Visible = true; ReceiptVoucherHeader vh = new ReceiptVoucherHeader(); vh.DocumentID = docID; vh.VoucherNo = voucherNo; vh.VoucherDate = voucherDate; ReceiptVoucherHeader rvh = ReceiptVoucherDB.getReceiptVoucherHeaderForTrailbalance(vh); txtTemporarryNo.Text = rvh.TemporaryNo.ToString(); dtTempDate.Value = rvh.TemporaryDate; txtVoucherNo.Text = rvh.VoucherNo.ToString(); dtVoucherDate.Value = rvh.VoucherDate; txtvoucherType.Text = rvh.VoucherType; cmbBookType.SelectedIndex = Structures.ComboFUnctions.getComboIndex(cmbBookType, rvh.BookType); txtPayeeCode.Text = rvh.SLCode.ToString(); txtPayeeName.Text = rvh.SLName; txtBillDetails.Text = rvh.BillDetails; cmbBankTransMode.SelectedIndex = Structures.ComboFUnctions.getComboIndex(cmbBankTransMode, rvh.BankTransactionMode); cmbOfficeID.SelectedIndex = Structures.ComboFUnctions.getComboIndex(cmbOfficeID, rvh.OfficeID); cmbProjectID.SelectedIndex = cmbProjectID.FindString(rvh.ProjectID); cmbCurrencyID.SelectedIndex = Structures.ComboFUnctions.getComboIndex(cmbCurrencyID, rvh.CurrencyID); txtExchangeRate.Text = rvh.ExchangeRate.ToString(); txtVoucherAmount.Text = rvh.VoucherAmount.ToString(); txtvoucherAmountINR.Text = rvh.VoucherAmountINR.ToString(); txtAmountInWords.Text = NumberToString.convert(rvh.VoucherAmount.ToString()).Trim().Replace("INR", rvh.CurrencyID); txtnarration.Text = rvh.Narration.ToString(); List <ReceiptVoucherDetail> VDetail = ReceiptVoucherDB.getVoucherDetail(rvh); grdPRDetail.Rows.Clear(); int i = 0; decimal totCredit = 0; decimal totDebit = 0; foreach (ReceiptVoucherDetail vd in VDetail) { AddPRDetailRow(); grdPRDetail.Rows[i].Cells["AccountCode"].Value = vd.AccountCode; grdPRDetail.Rows[i].Cells["AccountName"].Value = vd.AccountName; grdPRDetail.Rows[i].Cells["AmountDebit"].Value = vd.AmountDebit; totDebit = totDebit + vd.AmountDebit; grdPRDetail.Rows[i].Cells["AmountCredit"].Value = vd.AmountCredit; totCredit = totCredit + vd.AmountCredit; grdPRDetail.Rows[i].Cells["ChequeNo"].Value = vd.ChequeNo; grdPRDetail.Rows[i].Cells["ChequeDate"].Value = vd.ChequeDate; i++; } txtTotalCreditAmnt.Text = totCredit.ToString(); txtTotalDebitAmnt.Text = totDebit.ToString(); } else if (docID == "JOURNALVOUCHER" || docID == "PJV" || docID == "SJV") { grdPRDetail.Columns["PartyCode"].Visible = true; grdPRDetail.Columns["PartyName"].Visible = true; grdPRDetail.Columns["SLType"].Visible = true; grdPRDetail.Columns["ChequeNo"].Visible = false; grdPRDetail.Columns["ChequeDate"].Visible = false; JournalVoucherHeader jvhTemp = new JournalVoucherHeader(); jvhTemp.DocumentID = docID; jvhTemp.JournalNo = voucherNo; jvhTemp.JournalDate = voucherDate; JournalVoucherHeader jvh = JournalVoucherDB.getJournalHeaderForTrialBalance(jvhTemp); txtTemporarryNo.Text = jvh.TemporaryNo.ToString(); //txtvoucherType.Text = "Journal"; dtTempDate.Value = jvh.TemporaryDate; //txtAmountInWords.Text = NumberToString.convert(txtTotalDebitAmnt.Text); txtVoucherNo.Text = jvh.JournalNo.ToString(); dtVoucherDate.Value = jvh.JournalDate; txtnarration.Text = jvh.Narration.ToString(); decimal totDebit = 0; decimal totCredit = 0; List <JournalVoucherDetail> JVDetail = JournalVoucherDB.getJournalVoucherDetail(jvh); grdPRDetail.Rows.Clear(); int i = 0; foreach (JournalVoucherDetail jvd in JVDetail) { AddPRDetailRow(); grdPRDetail.Rows[i].Cells["AccountCode"].Value = jvd.AccountCode; grdPRDetail.Rows[i].Cells["AccountName"].Value = jvd.AccountName; grdPRDetail.Rows[i].Cells["PartyCode"].Value = jvd.SLCode; grdPRDetail.Rows[i].Cells["PartyName"].Value = jvd.SLName; grdPRDetail.Rows[i].Cells["SLType"].Value = jvd.SLType; grdPRDetail.Rows[i].Cells["AmountDebit"].Value = jvd.AmountDebit; grdPRDetail.Rows[i].Cells["AmountCredit"].Value = jvd.AmountCredit; totDebit = totDebit + jvd.AmountDebit; totCredit = totCredit + jvd.AmountCredit; i++; } txtTotalCreditAmnt.Text = totCredit.ToString(); txtTotalDebitAmnt.Text = totDebit.ToString(); txtAmountInWords.Text = NumberToString.convert(txtTotalDebitAmnt.Text); } } catch (Exception ex) { MessageBox.Show("Error in showing details"); } }
private void btnView_Click(object sender, EventArgs e) { grdList.Visible = true; grdList.Rows.Clear(); //------ double totalPOValue = 0.0; double totalInvoiceValue = 0.0; double balanceAmount = 0.0, Invoiceamt = 0.0, Paymntamunt = 0.0; //------ //pnlAddEdit.Visible = true; setButtonVisibility("Edit"); try { StringBuilder query = new StringBuilder(); query.Append("select TemporaryNo,TemporaryDate,PONo,PODate,CustomerName,ProductValueINR from ViewPOHeader "); if (cmbTrack.SelectedIndex != -1) { string str = "where PODate >= '" + dtFrom.Value.ToString("yyyy-MM-dd") + "' and PODate <='" + dtTo.Value.ToString("yyyy-MM-dd") + "'"; if (cmbTrack.SelectedItem.ToString() == "Open") { str += "and Status=1 and DocumentStatus = 99"; } else if (cmbTrack.SelectedItem.ToString() == "Closed") { str += " and Status=7 and DocumentStatus = 99"; } else { str += "and Status in (1,7) and DocumentStatus = 99 "; } query.Append(str); } if (cmbCustomer.SelectedItem.ToString() != "All") { query.Append(" and CustomerID='" + ((Structures.ComboBoxItem)cmbCustomer.SelectedItem).HiddenValue + "'"); } query.Append(" Order by PONo,PODate"); PurchaseOrderDB popihdb = new PurchaseOrderDB(); InvoiceInHeaderDB InvoDb = new InvoiceInHeaderDB(); PaymentVoucherDB PaymtvDB = new PaymentVoucherDB(); List <poheader> POPIHeaders = popihdb.ListPopiFilters2(query.ToString()); List <MRNHeader2> pop = popihdb.getMRNHeaderdata(); List <invoiceinheader> Invoices = InvoDb.getInvoicedata(); List <paymentvoucher> Payments = PaymtvDB.getPaymentdata(); foreach (poheader popih in POPIHeaders) { grdList.Rows.Add(); grdList.Rows[grdList.RowCount - 1].Cells["gTemporaryNo"].Value = popih.TemporaryNo; grdList.Rows[grdList.RowCount - 1].Cells["gTemporaryDate"].Value = popih.TemporaryDate; grdList.Rows[grdList.RowCount - 1].Cells["gTrackingNo"].Value = popih.PONo; grdList.Rows[grdList.RowCount - 1].Cells["gTrackingDate"].Value = popih.PODate; grdList.Rows[grdList.RowCount - 1].Cells["gCustomerName"].Value = popih.CustomerName; grdList.Rows[grdList.RowCount - 1].Cells["POValueINR"].Value = popih.ProductValueINR; grdList.Rows[grdList.RowCount - 1].Cells["TotalValueBilled"].Value = 0; totalPOValue += popih.ProductValueINR; if (popih.PONo != 0 && popih.PODate != DateTime.MinValue) { var results = pop.Where(oh => oh.PONos.Contains("" + popih.PONo + "") && oh.PODates.Contains("" + popih.PODate.ToString("yyyy-MM-dd") + "")).ToList(); int[] MRNNos = results.Select(i => i.MRNNo).ToArray(); DateTime[] MrnDats = results.Select(i => i.MRNDate).ToArray(); var AVC = from x in Invoices where MRNNos.Contains(x.MRNNo) && MrnDats.Contains(x.MRNDate) select x; string [] ABCCD = AVC.Select(i => i.DocumentID.ToString() + Main.delimiter1 + i.DocumentNo.ToString() + Main.delimiter1 + i.DocumentDate.ToString("yyyy-MM-dd") + Main.delimiter2).ToArray(); var AVC2 = from x in Payments where ABCCD.Contains(x.BillDetails) select x; double iamt = results.Sum(item => item.MRNValue); Invoiceamt = AVC.Sum(item => item.InvoiceValueINR); Paymntamunt = AVC2.Sum(item => Convert.ToDouble(item.VoucherAmountINR)); grdList.Rows[grdList.RowCount - 1].Cells["TotalValueBilled"].Value = iamt; totalInvoiceValue += iamt; } balanceAmount = Convert.ToDouble(grdList.Rows[grdList.RowCount - 1].Cells["POValueINR"].Value) - Convert.ToDouble(grdList.Rows[grdList.RowCount - 1].Cells["TotalValueBilled"].Value); grdList.Rows[grdList.RowCount - 1].Cells["BalanceAmount"].Value = balanceAmount; grdList.Rows[grdList.RowCount - 1].Cells["InvoiceAmt"].Value = Invoiceamt; grdList.Rows[grdList.RowCount - 1].Cells["Payamt"].Value = Paymntamunt; grdList.Rows[grdList.RowCount - 1].Cells["AmtBalance"].Value = Invoiceamt - Paymntamunt;; } } catch (Exception ex) { MessageBox.Show("Error in PO Product Inward Report Listing"); grdList.Rows.Clear(); } if (grdList.Rows.Count <= 0) { btnExportToExcel.Visible = false; grdList.Visible = false; pnlTotal.Visible = false; MessageBox.Show("No Data to Show"); } else { lblPOValue.Text = Math.Round(totalPOValue / 100000, 2).ToString() + " Lakhs"; lblBilledValue.Text = Math.Round(totalInvoiceValue / 100000, 2).ToString() + " Lakhs"; lblBalanceValue.Text = Math.Round((totalPOValue - totalInvoiceValue) / 100000, 2).ToString() + " Lakhs"; lblPOCount.Text = " PO Count:" + grdList.Rows.Count; pnlTotal.Visible = true; } }
private void grdList_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex < 0) { return; } string columnName = grdList.Columns[e.ColumnIndex].Name; if (columnName.Equals("Details")) { int rowIndex = e.RowIndex; if (rowIndex == 1) { List <ReceiptVoucherHeader> recptList = ReceiptVoucherDB.getAllNonDepositedReceiptsForReportBR(FYStartTIme, dtRecDate.Value, txtBankCode.Text); grdVoucherList.Rows.Clear(); grdVoucherList.Visible = false; btnClose.Visible = false; foreach (ReceiptVoucherHeader rvh in recptList) { if (rvh.VoucherAmount != 0) //If Debit amount is not equal to zero { grdVoucherList.Rows.Add(); grdVoucherList.Rows[grdVoucherList.Rows.Count - 1].Cells["DocumentID"].Value = rvh.DocumentID; grdVoucherList.Rows[grdVoucherList.Rows.Count - 1].Cells["VoucherNo"].Value = rvh.VoucherNo; grdVoucherList.Rows[grdVoucherList.Rows.Count - 1].Cells["VoucherDate"].Value = rvh.VoucherDate; grdVoucherList.Rows[grdVoucherList.Rows.Count - 1].Cells["PartyName"].Value = rvh.SLName; grdVoucherList.Rows[grdVoucherList.Rows.Count - 1].Cells["DebitAmount"].Value = rvh.VoucherAmount; // For Debit AMount INR grdVoucherList.Rows[grdVoucherList.Rows.Count - 1].Cells["CreditAmount"].Value = rvh.VoucherAmountINR; // For Credit AMount INR } } if (grdVoucherList.Rows.Count == 0) { MessageBox.Show("Voucher Not found"); } else { grdVoucherList.Visible = true; btnClose.Visible = true; } } else if (rowIndex == 2) { List <paymentvoucher> PayList = PaymentVoucherDB.getAllNonDepositedPaymentsForReportBR(FYStartTIme, dtRecDate.Value, txtBankCode.Text); grdVoucherList.Rows.Clear(); grdVoucherList.Visible = false; btnClose.Visible = false; foreach (paymentvoucher pvh in PayList) { if (pvh.VoucherAmountINR != 0) //If Credit amount is not equal to zero { grdVoucherList.Rows.Add(); grdVoucherList.Rows[grdVoucherList.Rows.Count - 1].Cells["DocumentID"].Value = pvh.DocumentID; grdVoucherList.Rows[grdVoucherList.Rows.Count - 1].Cells["VoucherNo"].Value = pvh.VoucherNo; grdVoucherList.Rows[grdVoucherList.Rows.Count - 1].Cells["VoucherDate"].Value = pvh.VoucherDate; grdVoucherList.Rows[grdVoucherList.Rows.Count - 1].Cells["PartyName"].Value = pvh.SLName; grdVoucherList.Rows[grdVoucherList.Rows.Count - 1].Cells["DebitAmount"].Value = pvh.VoucherAmount; // For Debit AMount INR grdVoucherList.Rows[grdVoucherList.Rows.Count - 1].Cells["CreditAmount"].Value = pvh.VoucherAmountINR; // For Credit AMount INR } } if (grdVoucherList.Rows.Count == 0) { MessageBox.Show("Voucher Not found"); } else { grdVoucherList.Visible = true; btnClose.Visible = true; } } } else { return; } } catch (Exception ex) { } }
private void grdMainList_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex < 0) { return; } string columnName = grdMainList.Columns[e.ColumnIndex].Name; if (columnName.Equals("Detail")) { if (Convert.ToInt32(grdMainList.CurrentRow.Cells["gNo"].Value) == 0) { MessageBox.Show("No of Item is zero"); return; } grdDetailList.Rows.Clear(); grdDetailList.Visible = true; btnCancel.Visible = true; string Head = grdMainList.CurrentRow.Cells["Received"].Value.ToString(); if (Head.Equals("PO Received")) { List <popiheader> ppopi = POPIHeaderDB.getPOPIINFOForProjectTrans(txtProjectID.Text); int i = 1; grdDetailList.Columns["DocumentNo"].HeaderText = "Tracking No"; grdDetailList.Columns["DocumentDate"].HeaderText = "Tracking Date"; grdDetailList.Columns["Customer"].HeaderText = "Customer"; grdDetailList.Columns["CustPODate"].HeaderText = "CustPODate"; grdDetailList.Columns["gValue"].HeaderText = "Value"; grdDetailList.Columns["TaxAmount"].HeaderText = "Tax Amount"; grdDetailList.Columns["CustPONo"].Visible = true; grdDetailList.Columns["CustPODate"].Visible = true; grdDetailList.Columns["gValue"].Visible = true; grdDetailList.Columns["TaxAmount"].Visible = true; foreach (popiheader popih in ppopi) { grdDetailList.Rows.Add(); grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["LineNo"].Value = i; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["DocumentNo"].Value = popih.TrackingNo; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["DocumentDate"].Value = popih.TrackingDate; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["Customer"].Value = popih.CustomerName; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["gValue"].Value = popih.ProductValue; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["TaxAmount"].Value = popih.TaxAmount; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["TotalAmount"].Value = popih.POValue; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["CustPONo"].Value = popih.CustomerPONO; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["CustPODate"].Value = popih.CustomerPODate; i++; } } else if (Head.Equals("Work Order Issued")) { int i = 1; grdDetailList.Columns["DocumentNo"].HeaderText = "WO No"; grdDetailList.Columns["DocumentDate"].HeaderText = "WO Date"; grdDetailList.Columns["Customer"].HeaderText = "Customer"; grdDetailList.Columns["gValue"].HeaderText = "Value"; grdDetailList.Columns["TaxAmount"].HeaderText = "Tax Amount"; grdDetailList.Columns["CustPONo"].Visible = false; grdDetailList.Columns["CustPODate"].Visible = false; grdDetailList.Columns["gValue"].Visible = true; grdDetailList.Columns["TaxAmount"].Visible = true; List <workorderheader> wohList = WorkOrderDB.getRVINFOForProjectTrans(txtProjectID.Text); foreach (workorderheader woh in wohList) { grdDetailList.Rows.Add(); grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["LineNo"].Value = i; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["DocumentNo"].Value = woh.WONo; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["DocumentDate"].Value = woh.WODate; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["Customer"].Value = woh.CustomerName; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["gValue"].Value = woh.ServiceValue; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["TaxAmount"].Value = woh.TaxAmount; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["TotalAmount"].Value = woh.TotalAmount; i++; } } else if (Head.Equals("Material Supplied")) { int i = 1; grdDetailList.Columns["DocumentNo"].HeaderText = "Invoice No"; grdDetailList.Columns["DocumentDate"].HeaderText = "Invoice Date"; grdDetailList.Columns["Customer"].HeaderText = "Customer"; grdDetailList.Columns["gValue"].HeaderText = "Value"; grdDetailList.Columns["TaxAmount"].HeaderText = "Tax Amount"; grdDetailList.Columns["CustPONo"].Visible = false; grdDetailList.Columns["CustPODate"].Visible = false; grdDetailList.Columns["gValue"].Visible = true; grdDetailList.Columns["TaxAmount"].Visible = true; List <invoiceoutheader> iohList = InvoiceOutHeaderDB.getRVINFOForProjectTrans(txtProjectID.Text); foreach (invoiceoutheader ioh in iohList) { grdDetailList.Rows.Add(); grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["LineNo"].Value = i; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["DocumentNo"].Value = ioh.InvoiceNo; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["DocumentDate"].Value = ioh.InvoiceDate; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["Customer"].Value = ioh.ConsigneeName; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["gValue"].Value = ioh.ProductValue; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["TaxAmount"].Value = ioh.TaxAmount; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["TotalAmount"].Value = ioh.InvoiceAmount; //grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["CustPONo"].Value = ioh.InvoiceNo; //grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["CustPODate"].Value = ioh.InvoiceDate; i++; } } else if (Head.Equals("Material Payment")) { int i = 1; grdDetailList.Columns["DocumentNo"].HeaderText = "Voucher No"; grdDetailList.Columns["DocumentDate"].HeaderText = "Voucher Date"; grdDetailList.Columns["gValue"].HeaderText = "Bill No"; grdDetailList.Columns["TaxAmount"].HeaderText = "Bill Date"; grdDetailList.Columns["CustPONo"].Visible = false; grdDetailList.Columns["CustPODate"].Visible = true; grdDetailList.Columns["CustPODate"].HeaderText = "SLType"; grdDetailList.Columns["Customer"].HeaderText = "SLName"; grdDetailList.Columns["gValue"].Visible = true; grdDetailList.Columns["TaxAmount"].Visible = true; List <paymentvoucher> pvhList = PaymentVoucherDB.getRVINFOForProjectTrans(txtProjectID.Text, 1); foreach (paymentvoucher pvh in pvhList) { grdDetailList.Rows.Add(); grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["LineNo"].Value = i; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["DocumentNo"].Value = pvh.VoucherNo; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["DocumentDate"].Value = pvh.VoucherDate; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["CustPODate"].Value = pvh.SLType; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["Customer"].Value = pvh.SLName; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["gValue"].Value = pvh.BillNo; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["TaxAmount"].Value = pvh.BillDate; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["TotalAmount"].Value = pvh.AmountDebit; i++; } } else if (Head.Equals("WO payment")) { int i = 1; grdDetailList.Columns["DocumentNo"].HeaderText = "Voucher No"; grdDetailList.Columns["DocumentDate"].HeaderText = "Voucher Date"; grdDetailList.Columns["gValue"].HeaderText = "Bill No"; grdDetailList.Columns["TaxAmount"].HeaderText = "Bill Date"; grdDetailList.Columns["CustPONo"].Visible = false; grdDetailList.Columns["CustPODate"].Visible = true; grdDetailList.Columns["CustPODate"].HeaderText = "SLType"; grdDetailList.Columns["Customer"].HeaderText = "SLName"; grdDetailList.Columns["gValue"].Visible = true; grdDetailList.Columns["TaxAmount"].Visible = true; List <paymentvoucher> pvhList = PaymentVoucherDB.getRVINFOForProjectTrans(txtProjectID.Text, 2); foreach (paymentvoucher pvh in pvhList) { grdDetailList.Rows.Add(); grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["LineNo"].Value = i; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["DocumentNo"].Value = pvh.VoucherNo; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["DocumentDate"].Value = pvh.VoucherDate; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["CustPODate"].Value = pvh.SLType; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["Customer"].Value = pvh.SLName; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["gValue"].Value = pvh.BillNo; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["TaxAmount"].Value = pvh.BillDate; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["TotalAmount"].Value = pvh.AmountDebit; i++; } } else if (Head.Equals("Employee Payments")) { } else if (Head.Equals("Other payments")) { int i = 1; grdDetailList.Columns["DocumentNo"].HeaderText = "Voucher No"; grdDetailList.Columns["DocumentDate"].HeaderText = "Voucher Date"; grdDetailList.Columns["gValue"].HeaderText = "Bill No"; grdDetailList.Columns["TaxAmount"].HeaderText = "Bill Date"; grdDetailList.Columns["CustPONo"].Visible = false; grdDetailList.Columns["CustPODate"].Visible = true; grdDetailList.Columns["CustPODate"].HeaderText = "SLType"; grdDetailList.Columns["Customer"].HeaderText = "SLName"; grdDetailList.Columns["gValue"].Visible = true; grdDetailList.Columns["TaxAmount"].Visible = true; List <paymentvoucher> pvhList = PaymentVoucherDB.getRVINFOForProjectTrans(txtProjectID.Text, 3); foreach (paymentvoucher pvh in pvhList) { grdDetailList.Rows.Add(); grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["LineNo"].Value = i; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["DocumentNo"].Value = pvh.VoucherNo; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["DocumentDate"].Value = pvh.VoucherDate; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["CustPODate"].Value = pvh.SLType; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["Customer"].Value = pvh.SLName; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["gValue"].Value = pvh.BillNo; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["TaxAmount"].Value = pvh.BillDate; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["TotalAmount"].Value = pvh.AmountDebit; i++; } } else if (Head.Equals("Receipts")) { int i = 1; grdDetailList.Columns["DocumentNo"].HeaderText = "Voucher No"; grdDetailList.Columns["DocumentDate"].HeaderText = "Voucher Date"; grdDetailList.Columns["CustPONo"].Visible = false; grdDetailList.Columns["CustPODate"].Visible = true; grdDetailList.Columns["CustPODate"].HeaderText = "SLType"; grdDetailList.Columns["Customer"].HeaderText = "SLName"; grdDetailList.Columns["gValue"].Visible = false; grdDetailList.Columns["TaxAmount"].Visible = false; List <ReceiptVoucherHeader> rvhlist = ReceiptVoucherDB.getRVINFOForProjectTrans(txtProjectID.Text); foreach (ReceiptVoucherHeader rvh in rvhlist) { grdDetailList.Rows.Add(); grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["LineNo"].Value = i; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["DocumentNo"].Value = rvh.VoucherNo; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["DocumentDate"].Value = rvh.VoucherDate; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["CustPODate"].Value = rvh.SLType; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["Customer"].Value = rvh.SLName; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["gValue"].Value = ""; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["TaxAmount"].Value = ""; grdDetailList.Rows[grdDetailList.RowCount - 1].Cells["TotalAmount"].Value = rvh.VoucherAmount; i++; } } else { grdDetailList.Rows.Clear(); grdDetailList.Visible = false; btnCancel.Visible = false; } } } catch (Exception ex) { } }