/// <summary> /// Print button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click_1(object sender, EventArgs e) { try { PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP(); if (dgvPhysicalStockReport.RowCount > 0) { DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); frmReport reportobj = new frmReport(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); DataTable dtblPhysicalStockReport = spPhysicalStockMaster.PhysicalStockReportFill(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), txtVoucherNo.Text.Trim(), txtProductName.Text.Trim(), Convert.ToDecimal(cmbProductCode.SelectedValue), Convert.ToDecimal(cmbVoucherType.SelectedValue)); ds.Tables.Add(dtblCompany); ds.Tables.Add(dtblPhysicalStockReport); reportobj.MdiParent = formMDI.MDIObj; reportobj.PhysicalStockReport(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("PSRT:6" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the grid based on the search condition /// </summary> public void gridfill() { try { PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP(); DataTable dtbl = new DataTable(); dtbl = spPhysicalStockMaster.PhysicalStockReportFill(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), txtVoucherNo.Text.Trim(), txtProductName.Text.Trim(), Convert.ToDecimal(cmbProductCode.SelectedValue), Convert.ToDecimal(cmbVoucherType.SelectedValue)); dgvPhysicalStockReport.DataSource = dtbl; if (dgvPhysicalStockReport.Columns.Count > 0) { dgvPhysicalStockReport.Columns["dgvtxtpurchaseRate"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dgvPhysicalStockReport.Columns["dgvtxtsalesRate"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dgvPhysicalStockReport.Columns["dgvtxtmrp"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; } } catch (Exception ex) { MessageBox.Show("PSRT1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }