/// <summary> /// Function to get the details of PurchaseReturn Report /// </summary> /// <param name="fromDate"></param> /// <param name="toDate"></param> /// <param name="decLedgerId"></param> /// <param name="decVoucherTypeId"></param> /// <param name="decInvoiceNo"></param> /// <param name="strProductCode"></param> /// <param name="strVoucherNo"></param> /// <returns></returns> public List <DataTable> PurchaseReturnReportGridFill(DateTime fromDate, DateTime toDate, decimal decLedgerId, decimal decVoucherTypeId, decimal decInvoiceNo, string strProductCode, string strVoucherNo) { PurchaseReturnMasterSP SPPurchaseReturnMaster = new PurchaseReturnMasterSP(); List <DataTable> ListObj = new List <DataTable>(); try { ListObj = SPPurchaseReturnMaster.PurchaseReturnReportGridFill(fromDate, toDate, decLedgerId, decVoucherTypeId, decInvoiceNo, strProductCode, strVoucherNo); } catch (Exception ex) { MessageBox.Show("PrBll 4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(ListObj); }
/// <summary> /// Function to fill datagridview /// </summary> public void PurchaseReturnReportGridFill() { string strProductCode = string.Empty; try { if (cmbCashOrParty.SelectedValue != null && cmbInvoiceNo.SelectedValue != null && cmbVoucherType.SelectedValue != null) { if (cmbCashOrParty.SelectedValue.ToString() != "System.Data.DataRowView" && cmbInvoiceNo.SelectedValue.ToString() != "System.Data.DataRowView" && cmbVoucherType.SelectedValue.ToString() != "System.Data.DataRowView") { if (txtFromDate.Text != string.Empty) { strFrmDate = txtFromDate.Text; } else { strFrmDate = string.Empty; } if (txtToDate.Text != string.Empty) { strToDate = txtToDate.Text; } else { strToDate = string.Empty; } if (cmbCashOrParty.SelectedIndex > -1) { decLedgerID = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()); } else { decLedgerID = -1; } if (cmbVoucherType.SelectedValue.ToString() != string.Empty || cmbVoucherType.SelectedIndex > -1) { decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()); } else { decVoucherTypeId = -1; } if (cmbInvoiceNo.SelectedValue.ToString() != string.Empty || cmbInvoiceNo.SelectedIndex > -1) { decInvoice = Convert.ToDecimal(cmbInvoiceNo.SelectedValue.ToString()); } else { decInvoice = -1; } if (txtVoucherNo.Text != string.Empty) { strVoucherNo = txtVoucherNo.Text; } else { strVoucherNo = string.Empty; } if (txtProductCode.Text != string.Empty) { strProductCode = txtProductCode.Text; } else { strProductCode = string.Empty; } dtblReg = spPurchaseReturnMaster.PurchaseReturnReportGridFill(Convert.ToDateTime(strFrmDate), Convert.ToDateTime(strToDate), decLedgerID, decVoucherTypeId, decInvoice, strProductCode, strVoucherNo); dgvPurchaseReturnReport.DataSource = dtblReg; if (dtblReg.Rows.Count > 0) { decimal decTotal = 0; for (int i = 0; i < dtblReg.Rows.Count; i++) { if (dtblReg.Rows[i]["totalAmount"].ToString() != null) { decTotal = decTotal + Convert.ToDecimal(dtblReg.Rows[i]["totalAmount"].ToString()); } } decTotal = Math.Round(decTotal, 2); txtTotalAmount.Text = decTotal.ToString(); } else { txtTotalAmount.Text = "0.00"; } } } } catch (Exception ex) { MessageBox.Show("PRRT:05" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }