插入后,我在asp.net应用程序中生成水晶报表作为账单或收据。我正在模态中执行此操作。一切工作正常,报告也已生成,但它无法以某种方式正确显示在模式中。仅在单击“组树”按钮后,它才会显示。帮我整理一下。
我正在将C#和asp.net用作前端,将SQL用于数据库。
我的ASPX标记:
<div class="modal-dialog modal-lg">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header bg-default-gradient">
<h4 class="modal-title">Quick Bill Reciept</h4>
<div class="pull-right">
<div class="form-group">
<asp:LinkButton ID="lnkPrint2" runat="server" CssClass="btn btn-success" OnClientClick="PrintFinalReceipt()" CausesValidation="false"> <i class="fa fa-print"></i> Print Receipt</asp:LinkButton>
</div>
</div>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<div class="modal-body card-body bg-default-gradient">
<div class="row">
<div class="col-md-12">
<div class="form-group" style="overflow: scroll; width: 100%; height: 50%">
<div id="dvReportFinal">
<CR:CrystalReportViewer ID="rptFinalSales" runat="server" AutoDataBind="true" HasRefreshButton="True" EnableDatabaseLogonPrompt="False" DisplayToolbar="False" ToolPanelView="None" BorderColor="#333300" />
<CR:CrystalReportSource ID="CrystalReportSource2" runat="server">
<Report FileName="Reports/FinalBillHappyCakes.rpt">
</Report>
</CR:CrystalReportSource>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer bg-default-gradient">
</div>
</div>
</div>
</div>
和C#代码:
protected void Confirm(object sender, EventArgs e)
{
try
{
if(drpBillType.SelectedIndex.ToString() == "1")
{
foreach (GridViewRow g1 in Gridview1.Rows)
{
string ITEMNAME = (g1.FindControl("drpItemname") as DropDownList).Text;
string QTY = (g1.FindControl("txtQtty") as TextBox).Text;
string UP = (g1.FindControl("txtUnitPrice") as TextBox).Text;
string GST = (g1.FindControl("txtGst") as TextBox).Text;
string TOT = (g1.FindControl("txtTotalPrice") as TextBox).Text;
string InsertQuery = "Insert into Sales(bno,cdate,ctime,deldate,name,mobileno,address,gstno,pan,description,qtty,rate,linetotal,gst,totamt,paidamt,balamt,orderstatus,status,rem,FinancialYear) values(@bno,@cdate,@ctime,@deldate,@name,@mobileno,@address,@gstno,@pan,@description,@qtty,@rate,@linetotal,@gst,@totamt,@paidamt,@balamt,@orderstatus,@status,@rem,@FinancialYear)";
using (SqlConnection con = new SqlConnection(constring))
{
con.Open();
using (SqlCommand cmd = new SqlCommand(InsertQuery, con))
{
cmd.Parameters.AddWithValue("@bno", Convert.ToInt64(lblBillNo.Text));
cmd.Parameters.AddWithValue("@cdate", systemdate.ToString());
cmd.Parameters.AddWithValue("@ctime", systemtime.ToString());
cmd.Parameters.AddWithValue("@deldate", txtDelDate.Text);
cmd.Parameters.AddWithValue("@name", txtcname.Text);
cmd.Parameters.AddWithValue("@mobileno", txtcmobile.Text);
cmd.Parameters.AddWithValue("@address", txtcaddress.Text);
cmd.Parameters.AddWithValue("@gstno", txtgst.Text);
cmd.Parameters.AddWithValue("@pan", txtcpan.Text);
cmd.Parameters.AddWithValue("@description", ITEMNAME);
cmd.Parameters.AddWithValue("@qtty", QTY);
cmd.Parameters.AddWithValue("@rate", Convert.ToDecimal(UP));
cmd.Parameters.AddWithValue("@linetotal", Convert.ToDecimal(TOT));
cmd.Parameters.AddWithValue("@gst", Convert.ToDecimal(GST));
cmd.Parameters.AddWithValue("@totamt", Convert.ToDecimal(txtAmtPayable.Text));
cmd.Parameters.AddWithValue("@paidamt", (txtAmtPaid.Text));
cmd.Parameters.AddWithValue("@balamt", Convert.ToDecimal(txtBalAmt.Text));
cmd.Parameters.AddWithValue("@orderstatus", "quick");
cmd.Parameters.AddWithValue("@status", "0");
cmd.Parameters.AddWithValue("@rem", "0");
cmd.Parameters.AddWithValue("@FinancialYear", lblFinYear.Text);
int i = cmd.ExecuteNonQuery();
if (i > 0)
{
BindData();
LoadQuickReceipt();
ClientScript.RegisterStartupScript(this.GetType(), "Pop", "OpenFinalOrderModal();", true);
}
}
}
}
Clear();
Mylogic();
SetInitialRow();
}
else if(drpBillType.SelectedIndex.ToString() == "2")
{
foreach (GridViewRow g1 in Gridview1.Rows)
{
string ITEMNAME = (g1.FindControl("drpItemname") as DropDownList).Text;
string QTY = (g1.FindControl("txtQtty") as TextBox).Text;
string UP = (g1.FindControl("txtUnitPrice") as TextBox).Text;
string GST = (g1.FindControl("txtGst") as TextBox).Text;
string TOT = (g1.FindControl("txtTotalPrice") as TextBox).Text;
string InsertQuery = "Insert into Sales(bno,cdate,ctime,deldate,name,mobileno,address,gstno,pan,description,qtty,rate,linetotal,gst,totamt,paidamt,balamt,orderstatus,status,rem,FinancialYear) values(@bno,@cdate,@deldate,@ctime,@name,@mobileno,@address,@gstno,@pan,@description,@qtty,@rate,@linetotal,@gst,@totamt,@paidamt,@balamt,@orderstatus,@status,@rem,@FinancialYear)";
using (SqlConnection con = new SqlConnection(constring))
{
con.Open();
using (SqlCommand cmd = new SqlCommand(InsertQuery, con))
{
cmd.Parameters.AddWithValue("@bno", Convert.ToInt64(lblBillNo.Text));
cmd.Parameters.AddWithValue("@cdate", systemdate.ToString());
cmd.Parameters.AddWithValue("@ctime", systemtime.ToString());
cmd.Parameters.AddWithValue("@deldate", txtDelDate.Text);
cmd.Parameters.AddWithValue("@name", txtcname.Text);
cmd.Parameters.AddWithValue("@mobileno", txtcmobile.Text);
cmd.Parameters.AddWithValue("@address", txtcaddress.Text);
cmd.Parameters.AddWithValue("@gstno", txtgst.Text);
cmd.Parameters.AddWithValue("@pan", txtcpan.Text);
cmd.Parameters.AddWithValue("@description", ITEMNAME);
cmd.Parameters.AddWithValue("@qtty", QTY);
cmd.Parameters.AddWithValue("@rate", Convert.ToDecimal(UP));
cmd.Parameters.AddWithValue("@linetotal", Convert.ToDecimal(TOT));
cmd.Parameters.AddWithValue("@gst", Convert.ToDecimal(GST));
cmd.Parameters.AddWithValue("@totamt", Convert.ToDecimal(txtAmtPayable.Text));
cmd.Parameters.AddWithValue("@paidamt", (txtAmtPaid.Text));
cmd.Parameters.AddWithValue("@balamt", Convert.ToDecimal(txtBalAmt.Text));
cmd.Parameters.AddWithValue("@orderstatus", "order");
cmd.Parameters.AddWithValue("@status", "0");
cmd.Parameters.AddWithValue("@rem", "0");
cmd.Parameters.AddWithValue("@FinancialYear", lblFinYear.Text);
int i = cmd.ExecuteNonQuery();
if (i > 0)
{
BindData();
LoadOrderReceipt();
ClientScript.RegisterStartupScript(this.GetType(), "Pop", "OpenPendingOrderModal();", true);
}
}
}
}
Clear();
Mylogic();
SetInitialRow();
}
}
catch (Exception ex)
{
throw ex;
}
}