private void btnSave_Click(object sender, EventArgs e) { if (!dxValidationProvider2.Validate()) { return; } if (gvRefund.RowCount == 0) { return; } new RefundRepository().InsertCRefundWOBill(dtRefund, Utility.logininfo.UserID, txtCustomerName.EditValue, txtCustomerMobile.EditValue); rptCRefund rpt = new rptCRefund(dtRefund); rpt.Parameters["GSTIN"].Value = "37AADFV6514H1Z2"; rpt.Parameters["FSSAI"].Value = "10114004000548"; rpt.Parameters["Address"].Value = Utility.branchinfo.BranchAddress; rpt.Parameters["BillDate"].Value = DateTime.Now; rpt.Parameters["BillNumber"].Value = "NA"; rpt.Parameters["BranchName"].Value = Utility.branchinfo.BranchName; rpt.Parameters["CounterName"].Value = Utility.branchinfo.BranchCounterName; rpt.Parameters["Phone"].Value = Utility.branchinfo.PhoneNumber; rpt.Parameters["UserName"].Value = Utility.logininfo.UserFullName; rpt.Print(); this.Close(); }
private void btnSave_Click(object sender, EventArgs e) { try { DataTable dt = gcBillDetails.DataSource as DataTable; DataView dv = dt.DefaultView; dv.RowFilter = "REFUNDQUANTITY > 0"; DataTable dtFiltered = dv.ToTable(); if (dtFiltered.Rows.Count == 0) { throw new Exception("Refund quantity should be greater than '0'"); } new RefundRepository().InsertCRefund(dtFiltered, Utility.logininfo.UserID); rptCRefund rpt = new rptCRefund(dtFiltered); rpt.Parameters["GSTIN"].Value = "37AADFV6514H1Z2"; rpt.Parameters["FSSAI"].Value = "10114004000548"; rpt.Parameters["Address"].Value = Utility.branchinfo.BranchAddress; rpt.Parameters["BillDate"].Value = DateTime.Now; rpt.Parameters["BillNumber"].Value = txtBillNumber.EditValue; rpt.Parameters["BranchName"].Value = Utility.branchinfo.BranchName; rpt.Parameters["CounterName"].Value = Utility.branchinfo.BranchCounterName; rpt.Parameters["Phone"].Value = Utility.branchinfo.PhoneNumber; rpt.Parameters["UserName"].Value = Utility.logininfo.UserFullName; rpt.Print(); this.Close(); } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } }